DEV Community

unlimit
unlimit

Posted on

N Queens Problem

How can we place N chess queens on a N × N chessboard so that no two queens threaten each other?

Solution:
In the following backtracking is used to solve the problem.
Backtracking is one of the important way of solving problem. But, for now lets focus on solving the problem wherein the N Queens should be placed on NxN chessboard such that no queens threatens no other queen, in how many ways we can do so?

N Queens

Top comments (0)