Question bank › Backtracking
Dsa Backtracking Easy

N-Queens Placement

You need to place N queens on an N x N chessboard such that no two queens threaten each other. Your task is to print all distinct configurations where the queens can be placed. Each configuration should be a list of integers where the i-th integer denotes the column of the queen placed in the i-th row. Input Format: The first line contains an integer N (1 <= N <= 10). Output Format: Print all configurations, each on a new line. Example Input: 4 Example Output: [1, 3, 0, 2] [2, 0, 3, 1]

Key concepts

backtrackingchessconstraint satisfaction

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.