Remove duplicates-strings

one test case is failing can u plz tell the error here is the link–https://ide.codingblocks.com/s/110105

Use if(n==0)
return;
rather n<0, and then try to submit

it is giving correct answer but what was the problem i didn’t get it @yuktimutreja01

See, n represents the total length, thus in all such questions, n can never be negative, thus always we check that if n==0 or not, it means that you have traversed all of the characters in the string or char array.

1 Like