i found it is same with move zero problem, the difference are it's a specific value and the original order of the numbers is not cared. so i use the two pointer just as move zero problem. it works! since the original order is not required i think there maybe better way to solve the problem. i tried begin one pointer backwards, it failed a lot of times, it's horrible, so many edge cases to take care, even though the code was submit successfully but the logic is really in a mess. i gave up to refactor and check the solutions. in the solution they don't exchange the two value, just replace since the order is not required. but in the process of trying to find better way, i learned to take edge cases into account.
when i want to double check the algorithm of move zero, i mistook it's number as 26. after reading the description i found i don't know how to solve it! there's totally no clue in my mind about the solution i once checked. i tried hardly and finally solve it by myself! that's great.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)