Please find the error. i did find a better code but I wanted to know what's wrong with my code

hello @ramitkapoor

pls check ur code link , u have shared wrong link

so sorry, my bad. Here’s the right one

@ramitkapoor

u r modifying value of n.
dont do n–, no need of three loops if u are using two pointers

check this->