Please see my blog for details:
How do you prove that your idea works in theory without submit the code? Intuitively, you idea seems work, but I am not sure it is guaranteed.
The novelty of my algorithm is only to append the string with itself before comparison.
It's deduced with the comparison of any two strings:
e.g., "1121" and "112".
We can get correct answer from the comparison between "11211121" and "11211211".
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.