N Queens
Learn about the classic n Queens problem and its solution using backtracking.
We'll cover the following
Introduction to backtracking
The prototypical backtracking problem is the classical Queens problem, first proposed by German chess enthusiast Max Bezzel in 1848 (under his pseudonym “Schachfreund”) for the standard 8 × 8 board and by François-Joseph Eustache Lionnet in 1869 for the more general board. The problem is to place queens on an chessboard so that no two queens are attacking each other. For readers not familiar with the rules of chess, this means that no two queens are in the same row, the same column, or the same diagonal.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy