N-queens problem
= N-queens problem
{c}
{title2=$N$}
= N-queen problem
{c}
{synonym}
Place $N$ queens on an $N\times N$ chessboard so that none share a row, column or diagonal. One <constraint satisfaction problem> encoding uses a column variable $C_r\in\{1,\ldots,N\}$ for each row, with $C_r\ne C_s$ and $|C_r-C_s|\ne|r-s|$ whenever $r\ne s$. The <pigeonhole principle> explains why one queen per row loses no solutions. Prescribed occupied cells give the <queens completion problem>.