Re:Programming Interview Question: Eight Queens
by thedigitalengel on Tuesday December 31, 2013 @09:04PM
(#6993843)
A quick solution involves starting at a corner, and placing each queen one horizontal and two vertical (a constrained knight's move, basically) away from the previous one. This works for an 8x8 board, but does not generalize to an NxN board (it is easy to see that this won't work when N is divisible by 3). Determining which N's it exactly works for is a math, not a programming puzzle, however. :)
[ Parent
| on HN ]
There are no comments on this comment yet.