1/102
Loading...
👑N-Queens Problem
Place 4 queens on a 4x4 chessboard so that no two queens attack each other. A queen can attack any square in the same row, column, or diagonal.
🔒
Loading...
Place 4 queens on a 4x4 chessboard so that no two queens attack each other. A queen can attack any square in the same row, column, or diagonal.
N-Queens is a problem of placing N queens on an N x N chessboard so that no two queens attack each other. Using backtracking, we explore all possible placements while immediately backtracking from invalid states.