Showing 3 of 4 questions
Traverse a matrix diagonally, returning the elements in a specific zig-zag order. You'll need to manage the direction and boundaries to output the elements correctly.
#1. Diagonal Traverse
Determine the number of distinct ways to place N queens on an N x N chessboard such that no two queens attack each other. This is a variation of the classic N-Queens problem, focusing on counting solutions rather than generating them.
#2. N-Queens II
You're given an array representing weights. Implement a function to randomly pick an index from the array, where the probability of picking each index is proportional to its weight.
#3. Random Pick with Weight
Page 1 of 1 · 4 total