N-queen problem: javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

N-queen problem: javascript

please how do you get the number of possible solutions for the N queen problem? I have tried different methods, none seem to work for me in Javascript. for example, if you have a 7 by 7 chess board, with 7 queens, the solution is 40. what kind of 'decomposing condition' or base condition can i set to make the recursion stop?

29th Jan 2019, 10:22 AM
Marvis Omolu
Marvis Omolu - avatar
1 Answer
+ 4
#1: Note that each Queen has one unique row and column. #2: Brute Force check
29th Jan 2019, 10:42 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar