kowalsk1's blog

By kowalsk1, history, 6 years ago, In English

I submitted the following solution for today's B during the contest: http://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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah, thanks for the help, i should've stopped the for when the two elements were distinct.