Not as hard as imagine, we can assume holding the number and will go the furthest one after scan all index we can go. Use two pointer to store current index which we can handle. We continue process it until right point reach or exceed the end point.
Error:
- Have some confuse the ending condition, set right >= n - 1 at first, actually we need to set right > n - 1.