HomeDeveloper toolsN-Queens Backtracking Lab

N-Queens Backtracking Lab

Find non-attacking queen placements and preview a solution.

Processing stays in your browser. Enumerates solutions until your limit is reached. Reports whether enumeration stopped early; the preview shows the first solution.

How to use the n-queens backtracking lab

Find non-attacking queen placements and preview a solution. Complete the board size (1–10), solution limit (1–100) fields above. Choose Run tool, review the output, then copy or download the result.

Example

A four-by-four board has two N-Queens solutions.

Good to know

Enumerates solutions until your limit is reached. Reports whether enumeration stopped early; the preview shows the first solution.