Exercises/#147 N-Queens Problem
#147

N-Queens Problem

HardπŸ“¦ Arrays
155 XP

Problem

Place n queens on an nΓ—n chessboard such that no two queens attack each other. Return all distinct solutions.

Examples

Input: n = 4
Output: [[".Q..","...Q","Q...","..Q."],
         ["..Q.","Q...","...Q",".Q.."]]
backtrackingarray
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

147 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features