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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay