M4A1's blog

By M4A1, 4 years ago, In English

The key difference between this problem and the usual problem is an extra operation of swapping a character of one string with another. So we have 3 operations:

  1. Insert.
  2. Delete.
  3. Swap.

We can solve this problem by first resolving all the swap operations that we can perform and in the new strings, the difference in frequency of a character present in the both the strings is <= 1. But resolving all the swap operations will introduce a lot of conditioning for odd diff, even diff, mod>1 etc.

So can we solve this problem using a more simpler approach than rigorous if else?

Full text and comments »

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