N queen doubt - tle


sir please check why is it giving tle.

@Shivanchal-Agarwal-2530139037020445 n can be atmost 15.
To reduce the time complexity by a factor of n, you can use map<>. so your issafe func() would be ~O(1).
yo have to use 4 maps, one for row one for column and 1 for each diagonal.

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.