No of ways to arrange n-Queens in n*n chessboard | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

No of ways to arrange n-Queens in n*n chessboard

//PLease help me solve this problem //Complete this function to check placing queen at board[row][col] is safe or not by //checking current row, left diagonal & right diagonal. totalWays=0; int isSafe(int board[N][N], int row, int col) { int i , j; for(i=0; i< row-1; i++) { if(board[i][col] ==1) } // Complete this function to solve the problem and save the answers in sol array as required and put number of solutions in nos variable passed as last argument. int solveNQUtil(int board[N][N], int col, int sol[][N], int *nos) { }

23rd Jul 2021, 3:41 AM
Cynthia
Cynthia - avatar
1 ответ
0
Look up the equation online. Its algebra, the only one thats difficult is the diagnal checks. I also have a queens problem solver in Python, so you can get the equation from there
23rd Jul 2021, 3:45 AM
Slick
Slick - avatar