Where i went wrong in my logic

can you suggest !! any other approch

You can take help of editorial for getting the solution, since this is meant for leader board score, so its better to be ethical with that. But if you are still unable to get the solution than please ask again.

Happy learning. :blush:

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.