Queens that never attack
Place n chess queens on an n × n board so that no two attack each other: no two may share a row, a column or a diagonal. Return every such placement. Each row then holds exactly one queen, so write a placement as a list cols where cols[r] is the column (0-based) of the queen in row r. Return each placement once, in any order; if there is none, return an empty list.
1 ≤ n ≤ 9.
Examples
queen_placements(4)→[[1,3,0,2],[2,0,3,1]]queen_placements(1)→[[0]]queen_placements(3)→[]