How many queens and knights can you place on a chessboard?

A white chess queen and black chess knight's silhouettes against the sun.
Photo by ᴊᴀᴄʜʏᴍ ᴍɪᴄʜᴀʟ on Unsplash.

Problem statement

This is a harder variant of the 8 queens problem. As a warm-up for this problem, consider solving that one first!

For the “queens and knights” problem, you want to place as many queens and knights, as possible, on a chessboard. However, queens and knights must be placed in equal numbers, and no piece can attack any other piece.

While you are at it, can you do it in multiple ways?

For reference, here is a picture showing what squares a queen attacks:

Chessboard with a queen and the squares under attack.
Squares under attack by a queen.

Similarly, here is a picture showing what squares a knight attacks:

Chessboard with a knight and the squares under attack.
Squares under attack by a knight.

Give it some thought!

If you need any clarification whatsoever, feel free to ask in the comment section below.

This problem was brought to my attention by the late Roger Hui, so let my sharing this problem be a small tribute to him.


Congratulations to the ones that solved this problem correctly and, in particular, to the ones who sent me their correct solutions:

  • David H., Taiwan;

Know how to solve this?

Join the list of solvers by emailing me your solution!


I'll share the solution to this problem after it has been live for 2 weeks.

Don't forget to subscribe to the newsletter to get bi-weekly problems sent straight to your inbox.

Thanks for reading ❤️

If you enjoyed this blog article, you will love the mathspp insider 🐍🚀 newsletter! Join +16.000 others who are taking their Python 🐍 skills to the next level! 🚀

Previous Post Next Post

Blog Comments powered by Disqus.