Backtracking N-Queens DFS + Undo

N-Queens Visualizer

Place one queen in each row so that no two queens attack each other. The visualizer shows try → check → place → recurse → backtrack.

Current = blue Conflict = red Placed queen = green hint
Time complexity worst case: O(N!)
Current Thinking
Trying Row
0
Trying Column
-
Placed Queens
0
Status
Ready
Partial Solution
[_, _, _, _, _]

Meaning: index = row, value = column of queen.

Step Explanation
Start
We begin from row 0 and try columns one by one.
Logic Pattern
State
Current row
Choices
Any column in that row
Check
Same column / diagonal attack?
Backtrack
Remove queen and try next column