N-Queens Problem

Hard

📝 Description

Place N queens on N×N chessboard so no two queens threaten each other

Input Format

n (integer)

Output Format

All distinct solutions

Constraints

1 ≤ n ≤ 9

🔍 Sample Input

4
            

✅ Sample Output

[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run