Coding Trainer

N-Queens

HardBacktrackingLC #51

Problem

Place n queens on an n×n chessboard so no two queens attack each other. Return all distinct solutions.

Example: n=4 → [[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]