I submitted the following solution for today's B during the contest: http://mirror.codeforces.com/contest/1005/submission/40123027 But even later when i saw the test case, i couldn´t figure out what i did wrong, cause i think my logic is correct. Can someone explain why is my algorithm failing? Are there any corner cases in this problem?
Thanks in advance, have a great day.
Consider the case which first string is aaaa and second string is aabb. k should be 0,but your loop increases k two times, when it shouldn't. Your solution fails when you should delete all characters but your loop finds identical characters.
Yeah, thanks for the help, i should've stopped the for when the two elements were distinct.