Some of the test cases are not passing


3 test cases are not passing

Hello, @sp5513,

Change the below line,

return remove_duplicates(arr,n-1,i+1);

to

return remove_duplicates(arr,n-1,i);

We don’t need to increment i here as the size of the string is reduced by 1, and we need to check again at the present index.

For example, let string = aaa
now after the first step string becomes => aa
now we need to check at the present index again so that in the next step it is further reduced to “a”

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.