Please tell me the problem in my logic
Kartik, the logic u are using is not correct, I would suggest u to go through online lecture on “N-queen problem using backtracking” given in recursion section of the course and then implement your code using that approach only.
and why is my logic wrong ?? im not able to relate it with the code in the video that is why im asking my mistake
Kartik, for n-queen problem, you need to check that if it is safe to place a queen at any point, the safe point will be based on the fact that there will be no queen in left or right diagonals and also no queen will be there in same columns also, so if the condition gets violated, you need to perform backtracking, so pls follow this logic only, as other logic will not pass your test cases,