55. Jump Game

# Medium

Solution:

  1. 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)

  2. Two pointer: start and end move. If distance(end-start) <= nums[start], end jumps to start, start move to pre-element, set flat=True

  3. Using while loop to control the index of start until out of index.

  4. return result=flag

Last updated

Was this helpful?