N-Queens


Shekhar was a chess champion in his high school. Shekhar used to spend his holidays by playing chess with his grandpa. Once, grandpa asked him whether he could place eight queens on a chessboard such that no two queens would attack each other. Shekhar took about 30 minutes and found a solution. He also found a solution for a general n-cross-n chessboard. When he informed this to his grandpa, grandpa told him that there are a total of 92 solutions for 8-cross-8 chessboard and to find all those would require programming. Within 3 to 4 days, Shekhar learnt programming and generated all 92 solutions. He also generated 352 solutions for 9-cross-9 chessboard and 724 solutions for 10-cross-10 chessboard.

Do you have that dedication and learn ability to solve this problem?