Full threadpmorici·He left out the most efficient solution. Using bits to store the positions instead of an array then you can check if the queens conflict with a couple bitwise &&'s instead of looping.View on HN