The N-Queens puzzle places N queens on an N×N chessboard such that no two queens attack each other.
A queen can attack another queen if they share the same row, column, or diagonal.
Given a positive integer n, return the total number of distinct valid arrangements of n queens on an n×n board.

Solution Stats

2 Solutions

2 Solvers

Last Solution submitted on Sep 05, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers2

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!