+ 2

Rectify the error in the output optained in the following nqueen problem code .

https://code.sololearn.com/cGGaGN7tx8t5/?ref=app

9th Dec 2017, 9:15 PM
raveena kagne
raveena kagne - avatar
2 odpowiedzi
0
If you wish, I'll work with you to solve this by commenting on your code.
9th Dec 2017, 9:42 PM
John Wells
John Wells - avatar
- 1
Your 50 array size only supports a 7x7 board. The first meaningful board is 3x3 as only one queen can be on a 1x1 or 2x2. Therefore, you should only allow 3 to 7 for n or modify the array like x[9][9] (supports 9x9). The two dimensional array makes for more understandable code.
9th Dec 2017, 9:40 PM
John Wells
John Wells - avatar