Log In

After being able to validate whether a Queen placement is valid, we can use it to write a function called . It would return the columns in the next row that the existing Queens cannot visit, so the partial solution with an additional Queen would succeed.

The first parameter is and determines the size of the chessboard.

The second parameter is , which is an array of Queen positions. It is an array of arrays- the first value of the array is the row, and the second value is the column.

The third parameter is , which is an integer of the row to check.

01234567
0
1
2
3
4
5
6
7

The diagram above illustrates the following parameters:



would return [0, 5, 6, 7] in this case. The column values must be in ascending order.

If there are no columns to check, return an empty array.

Sign Up or Log In to access the code editor and answer the question!
Log In