Optimization on isValidConfiguration via order of conditional checks.
Fixed NQueens. Now terminating properly and returning good answers.

Apparently, the problem is due to the fact that getNextState _never_ returns
null and so the main loop never terminates.