Place queens one row at a time. In each row, try the columns from left to right and take the first square no queen attacks. If a row has no safe square, the choice above was wrong: lift that queen and slide it further along. This stops at the first solution.
- Average time
- O(N!)
- Space
- O(N²)