You are viewing Nextmv legacy docs. ⚡️ Go to latest docs ⚡️

Sdk

N Queens

Overview of the n-queens app.

Note, n-queens is available as an app on GitHub (contact support@nextmv.io for access). You can use it as is or configure it to meet your needs.

The n-queens App places n queens in an n x n chessboard so no queens attack each other by being in the same row, column or diagonal.

The cmd directory in the app folder contains the main.go, cmd.sh and supporting data files needed to run the app.

For n = 1 the problem has a trivial solution and no solution exists for n = 2 and n = 3.

A feasible solution for n = 4 is:

-  Q  -  -
-  -  -  Q
Q  -  -  -
-  -  Q  -
Copy

The following is an infeasible solution because there are queens attacking each other diagonally.

-  Q  -  -
Q  -  -  -
-  -  -  Q
-  -  Q  -
Copy

We are always adding new apps. If you are looking for a new one, email support@nextmv.io.

Page last updated