All challenges
Multiple ChoiceIntermediate 30s

Backtracking: N-Queens

The N-Queens problem is solved with backtracking by:
Options
  1. 1Hashing each occupied column and checking for collisions as queens are added
  2. 2Greedily placing every queen at once and repairing conflicts in a second pass
  3. 3Sorting the board positions first and then assigning queens by that order
  4. 4Placing queens row by row and backtracking when a placement is invalid

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle