whats wrong in mu code it is giving right ouput still its not clearing a single testcase
Https://ide.codingblocks.com/s/275766
Your code is going out of index if i==n-1 then and when i==0. So make sure you are handling those cases.
https://ide.codingblocks.com/s/275780 I have made the changes you may try submitting this code. If your issue has been resolved please close this doubt.
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.