N-Queens
Try to solve the N-Queens problem.
We'll cover the following
Statement
Given a chessboard of size , determine how many ways queens can be placed on the board, such that no two queens attack each other.
A queen can move horizontally, vertically, and diagonally on a chessboard. One queen can be attacked by another queen if both share the same row, column, or diagonal.
Constraints:
Examples
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy