r/programmingchallenges • • Jul 16 '12
N-Queens: C++
Looking for some help with the N-Queens puzzle. I have a recursive solution that works reasonably well for N <= 10, but it's not fast enough (Solve for N = 13 in < 5 seconds) I need to produce all possible combinations and print the queen positions in a certain way. I need a different algorithm than what I have at the moment, any help? I know that I can eliminate quite a lot of board positions by looking at reflections and rotations, but I do not know how to do this. Any Help?
5
Upvotes
View all comments
Show parent comment
1
u/[deleted] Jul 17 '12
Ok, Thank you. I'm gone away for the next while but when I get back this is the first thing I'm going to code :)