How to print n queen?

to print all the solutions of nqueen problem using bitset and backtracking, but this code is giving segmentation fault.

Hi @S19APP-PP0009, your logic is absolutely correct. There is just a small mistake in your code. In line number 12, it should be for(int j=0; j<size; j++) instead of for(int j=0; i<size; j++).

If your doubt still persists, reply to this thread or mark this doubt as resolved.

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.