What is the error in my code?

Hi @goyalvivek
refer this https://ide.codingblocks.com/s/635835

Unable to clear all testcases https://ide.codingblocks.com/s/635885

Hi @goyalvivek
https://ide.codingblocks.com/s/635835 this is passing all test cases… try submitting again

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.

ur code works fine, BUT what is wrong with mine https://ide.codingblocks.com/s/635885

ur code fails for n>=7… try to dry run for the same

basically in ur approach u would have to return a pair of <int,bool> where int value represents the count of ans and bool represents if soln was possible or not… or else refer my code i shared… just pass cnt by reference and increase its value when soln is possible… i hope it will clear all ur doubts…

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.