WC 3.2 The Queen Puzzle

Bhavna miss gives Sonali an interesting task. She gives Sonali an n x n chessboard. There are n Queens. Sonali has to place these n queens in the chessboard in such a way that: 1) No two queens are in the same row 2) No two queens are in the same column 3) No two queens are in the same diagonal.



There are two types of diagonals defined in the chessboard. Type 1: From top left corner to bottom right corner. All the paths in this direction (i.e. from top left corner to bottom right corner direction) will be considered as Type 1 diagonal path. Type 2: From top right corner to bottom left corner. All the paths in this direction (i.e. from top right corner to bottom left corner direction) will be considered as Type 2 diagonal path.



Note: Sonali can place two or more queens in Type 2 diagonal path but she can place only one queen in Type 1 diagonal path



Find the sum of answers for n=4,5,6,7



EXAMPLE 1: If n = 2, then there is only one way the queens can be placed.
_ Q
Q _
Therefore final answer is 1



EXAMPLE 2: If n = 3, then there are three ways the queens can be placed.
Solution 1:
Q _ _
_ _ Q
_ Q _
Solution 2:
_ Q _
Q _ _
_ _ Q
Solution 3:
_ _ Q
_ Q _
Q _ _
Therefore final answer is 3

IMPORTANT MESSAGE: The question text has been updated on 15th July 1:30AM. Any inconvenience caused is deeply regretted.


Click to view hint

This challenge is worth 80 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Krish Shah : 9323115454

Kaustubh Khavnekar : 9769408039



Privacy Policy