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:
- Insert.
- Delete.
- 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?