Re:Programming Interview Question: Eight Queens
by pmorici on Tuesday December 31, 2013 @08:11PM
(#6993694)
Here is a solution I wrote when I was an undergrad TA that uses only bit arrays and can check for a valid solution using bitwise logic operations. That said what a horrible interview question. The hard part about the problem is figuring out how to convert a x/y position on the board to a diagonal dx/dy coordinate. Once you figure that out the coding is simple but I remember it taking me a day of mulling over in the back of my head before the solution came to me in my sleep.
http://therandombit.blogspot.com/2008/09/n-queens-implmented...