Want to solve this problem? Login now to get access to solve the problems

Problem

Submissions

Solution

Leaderboard

Coming soon

4

Difficulty: HARD

Avg. time to solve

55 min

Success Rate

35%

Problem Statement

Suggest Edit

```
The first and the only line of input contains an integer 'N' representing the size of the chessboard and the number of queens.
```

```
Each line would be representing a single configuration.
Each configuration would contain N*N elements printed row-wise separated by spaces. The position where we can place the queen will have the value 1 rest will have the value 0.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= N <= 10
```

```
4
```

```
0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0
0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0
```

```
Output depicts two possible configurations of the chessboard for 4 queens.
The Chessboard matrix for the first configuration looks as follows:-
0 0 1 0
1 0 0 0
0 0 0 1
0 1 0 0
Queen contained cell is depicted by 1. As seen, No queen is in the same row, column or diagonal of the
other queens. Hence this is a valid configuration.
```

```
3
```

```
Since no possible configuration exists for 3 Queen's.The Output remains Empty.
```

Want to solve this problem? Login now to get access to solve the problems