:type nums: List[int] :rtype: bool
(self, nums)
| 35 | """ |
| 36 | class Solution(object): |
| 37 | def canJump(self, nums): |
| 38 | """ |
| 39 | :type nums: List[int] |
| 40 | :rtype: bool |
| 41 | """ |
| 42 | |
| 43 | |
| 44 | dp = [nums[0]] |
| 45 | current_index = 0 |
| 46 | |
| 47 | while 1: |
| 48 | if current_index + dp[-1] >= len(nums)-1: |
| 49 | return True |
| 50 | base = 0 |
| 51 | index = current_index |
| 52 | for i in range(current_index, current_index+dp[-1]+1): |
| 53 | if nums[i] + i > base: |
| 54 | base = nums[i] + i |
| 55 | index = i |
| 56 | |
| 57 | if current_index == index: |
| 58 | return False |
| 59 | |
| 60 | current_index = index |
| 61 | dp.append(base-index) |
nothing calls this directly
no outgoing calls
no test coverage detected