not showing the output
N-queen recursion problem
//left diagonal check
int x = row;
int y = col;
while(x>=0 && y>=0){
if(grid[x][y] == 1){
return false;
}
x--;
y--; // you didn't write x-- and y--.
}
//right diagonal check
x = row;
y = col;
while(x>=0 && y<n){
if(grid[x][y] == 1){
return false;
}
x--;
y++; // you didn't write x-- and y++.
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.