Sample solution to the n-1 Chess Queen(s) Arrangement Challenge in Node js and Php.
You must have Node installed to run the js file solution and php installed to run the php file solution.
To run, clone this repository, place files in a directory.
Navigate to the directory.
Run the following command
- Node js
node challenge.js
- Php
php challenge.php
Feel free to try out the challenge before making comparisons.
To add submissions in other languages, create a pull request.
Below is the challenge given.
Given an n x n Chess board, fit in n - 1 queens on the board such that they do not intersect or threaten each other.
Store the arrangements in a multidimensional array.
Print out the result assuming the board's rows are traversed from top to bottom(0 to n-1) and the board's columns are traversed from left to right(0 to n-1).
The arrangement implies that the top left square(first square) of the board has an index of 0,0.
This question does not need a web program. A console program is recommended.
You are free to make use of any programming language of your choice.
- n must not be less than 2.
- Avoid nested loops as performance may be greatly affected for higher values of n.