Algorithm · Snowflake · Medium
The n-queens puzzle asks you to position n queens on an n x n chessboard so that no pair of queens can attack one another. Given an integer n, return every distinct arrangement that solves the n-queens puzzle. The solutions may be listed in any order. Each arrangement must describe a unique board using 'Q' for a queen and '.' for an unoccupied square. Examples Example 1: Input: n = 4 Output: [[".Q..", "...Q", "Q...", "..Q."], ["..Q.", "Q...", "...Q", ".Q.."]] Explanation:…
Checking your access…