Over a million developers have joined DZone.

Excercise Your Coding Muscles

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

We thought we'd try something different here at JavaLobby. For the next few weeks, every Thursday, we'll publish a code puzzler for you to solve. I'm sure they'll be easy to solve for such a gifted community of readers as we have here, but let's give it a go. Use whatever frameworks/languages you think are appropriate to solve the question.

Note: Even though there really is nothing stopping you from finding a solution to this on the internet, try to keep honest, and come up with your own answer.  It's all about the participation!

The N Queens Puzzle

One of the classic programming challenges. What you need to do is place 8 queens on an 8x8 chess board in a way that no two queens attack each other. For those who don't play chess, this means that no two queens can be on the same row, column or diagonal.  Sounds simple? Go! 

What's the most efficient way to solve this?

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}