PythiloHard · 40 min · Task 96 of 100 · progress kept in this browser

Count N-Queens solutions

Return the number of ways to place n nonattacking queens on an n by n board, one per row. Count rotations separately; n=0 has one empty solution.

occupied_columns, occupied_down = {1}, {-1}
row, col = 1, 2
print(col in occupied_columns or row-col in occupied_down)
Your task

Return the number of ways to place n nonattacking queens on an n by n board, one per row. Count rotations separately; n=0 has one empty solution.