Log In

We were able to solve the N Queens problem using recursive backtracking.

Recursive backtracking involves building up partial solutions and looking for the next possible values to add to the partial solution such that the partial solution is still valid.

This is because a partial solution that already fails the constraints cannot lead to a full solution that passes the constraints, so those solutions can be skipped.

However, if each incremental step does not lead to an invalid partial solution, and that solution is built up into a full solution, that full solution would be valid, because it was valid every time it was added to.

Next