The third solution is really brilliant!
Ok, I got your point.
Two halves are sorted, and we are moving pointers in halves wisely. Reset i and j are correct but unnecessary.
Thanks for reply!
why you don't need to reset i and j in each left loop?
The indexes of i and j from prev loop can be directly applied to following loops?
How about the case:
input: ["wnlb"] output: "blnw"?
There is no way we can get the order of chars in this input, so I treat the order invalid and return "", but the oj gives error.
Oj treats it as a valid input, and return "blnw"
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.