one test case is failing can u plz tell the error here is the link–https://ide.codingblocks.com/s/110105
Remove duplicates-strings
Use if(n==0)
return;
rather n<0, and then try to submit
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