DEV Community

Sujit Parte
Sujit Parte

Posted on

N-Queens Problem

N-Queens Problem

The N-Queens problem is a classic combinatorial problem in which you must place N queens on an N × N chessboard such that:

No two queens attack each other, meaning:

  • No two queens are in the same row.
  • No two queens are in the same column.
  • No two queens are on the same diagonal.

N-Queens Problem Solution Using Backtracking Approach

Using Backtracking

N-Queens Problem Solution Using Branch And Bound Approach

Using Branch And Bound

I hope this would be helpful.

Top comments (0)