55. Jump Game
# Medium
Last updated
Was this helpful?
# Medium
Last updated
Was this helpful?
From end to beginning of the list to record True status. Two pointer: start, end. start move from previous of end until the element of the list can reach end, record True or False status until start out of index.
Initilize all variables. end = len(nums)-1, start = len(nums)-2, flag = True (because current status is: from last element to last element, it must be True)
Two pointer: start and end move. If distance(end-start) <= nums[start], end jumps to start, start move to pre-element, set flat=True
Using while loop to control the index of start until out of index.
return result=flag