N-queens
The problem of placing n chess queens on an n × n board so that none attacks another: not in the same row, the same column or the same diagonal.
Example
With 4 queens on a 4 × 4 board there are exactly 2 solutions; with 8 on an 8 × 8 board, there are 92.
Test yourself: N-queens
N-queens
2 queens cannot share a row, a column or a ___.
A queen on (0, 0) attacks (3, 3) along the diagonal, even though they are 3 rows apart.
N-queens
The squares (1, 3) and (3, 1) are on the same secondary diagonal because both add up to ___.
1 + 3 = 4 and 3 + 1 = 4: a queen on (1, 3) attacks (3, 1).
0/2
▶ Play