Skip to main content

Practice · 2 of 5

N-Queens Count

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Count the ways to place n non-attacking queens on an n x n board (no two share a row, column, or diagonal). **Input:** One line: n (1 <= n <= 10). **Output:** One integer — the number of placements. **Example:** 4 -> 2.

Back to lesson: Practice: Backtracking Problem Set