Mark As Completed Discussion

Base Conditions of Recursing Backtracking

We will start from the first element in the board. We will be putting Queens in places and then move forward. To do this, we will continuously place Queens if possible, and then increment row.

While incrementing row, we will reach at a point where row will be greater than n (out of the board). At that time, we have found a solution. So we will save a copy of the board and continue to backtrack for other solutions.

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment