Gamified challenge · Backtracking
Place n queens on an n × n board, one in each row, so that no two queens share a column or a diagonal. One queen is already pinned at row row, column col (0-based) and can't move.
Write placeQueens(n, row, col) (place_queens in Python) that returns q, where q[r] is the column of the queen in row r. Any safe placement counts. For n = 4, row = 0, col = 1 that's [1, 3, 0, 2].
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google