I’ve checked the forums and still no clue as to what’s wrong. I’m using C++.
https://www.codechef.com/viewsolution/14675377
Thanks!
I’ve checked the forums and still no clue as to what’s wrong. I’m using C++.
https://www.codechef.com/viewsolution/14675377
Thanks!
a.resize(25000);
b.resize(25000);
Keep string size atleast 1 more than the maximum size possible in constraint, to allow for “\0” character.
Additionally, your code fails for such cases-
Input
1
zzzzz xxxxzx
Your Output
YES
Expected Output
NO //Since neither is a subsequence of another- 2nd string needs more z i believe.
This error is because, you are deleting string b from index[0,4] only, while z occurs at index 5. So this z is available to satisfy all other z in string a. Meaning, check the upper limit of your deletion function. Its 1 index less than needed.
Wow. This forum is really responsive.
Thanks a lot vijju123. I had misunderstood string.erase()
when used with iterators. Only had to add +1 and got AC :))
You have eagle eyes.
This forum is most responsive one i ever came across ^^ . You will have eagle eyes too if you stay here a while and try to help