This article shows how to solve the N queens problem in 20 lines of code.
Check out codegolf.stackexchange.com if you want to solve programming puzzles, but with a twist.