**New course!**Every coder should learn

**Generative AI!**

+ 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?

1 Answer

+ 4

#1: Note that each Queen has one unique row and column.
#2: Brute Force check