# N Queens

Posted: 24 Sep, 2020

Difficulty: Hard

#### You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.

#### A queen can be killed when it lies in the same row, or same column, or the same diagonal of any of the other queens. You have to print all such configurations.

##### Input Format:

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

##### Output Format:

```
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.
```

##### Note:

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

##### Constraints:

```
1 <= 'N' <= 10
Time Limit: 1sec
```

SIMILAR PROBLEMS

Can You Print

Posted: 14 Apr, 2022

Difficulty: Easy

Prime Digit Sum

Posted: 17 Apr, 2022

Difficulty: Hard

Prime Digit Sum

Posted: 17 Apr, 2022

Difficulty: Hard

Mario And His Princess

Posted: 12 May, 2022

Difficulty: Moderate

Combination Sum III

Posted: 25 May, 2022

Difficulty: Moderate

Combination Sum III

Posted: 25 May, 2022

Difficulty: Moderate

Generate All Strings

Posted: 9 Jul, 2022

Difficulty: Moderate