# Interview Questions

Ritambhara Technologies - Coding Interview Preparations > Interview Questions > Logic > Puzzles > Chess board puzzle

# Chess board puzzle

- December 11, 2012
- Posted by: Kamal Rawat
- Category: Puzzles

No Comments

Imagine you have infinite number of Queens.

Find the minimum number of queens required so that every square grid on the chess board is under the attack of a queen.

Arrange this minimum no. of Queens on a chess board.

**Solution:**

Easiest solution is to put a queen in all the squares (64 queens required). We can obviously do much better than this.

**Queen @ every diagonal **

If we put one queen at each diagonal cells (i.e put a queen when i==j). Then also all the cells in the chess-board will be under attack.

**Improving the above solution:**

There will be more than one solution to the problem (If you rotate the chessboard, you will get another solution – if queens are non-symmetric).. Below is a solution with 5 queens: