Regarding some test cases

I am unable to find why I am not passing all the test cases.

Have debugged your code here, just was an issue with if else statement and also of data type. We have to take value of N as long long int instead of int, you can check the code here as it’s giving 100% result.

Oh, I forgot to consider β€œ2”. In some previous code, I used long long as well, but still the cases passed were some. Got the mistake, thanks.

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.