Skip to content

Commit ae8924c

Browse files
Create Jump Game Leetcode Problem.py
1 parent 5141006 commit ae8924c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Program/Jump Game Leetcode Problem.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def canJump(self, nums: List[int]) -> bool:
3+
goal = len(nums) - 1
4+
for i in range(len(nums)-1,-1,-1):
5+
if i + nums[i] >= goal:
6+
goal = i
7+
return goal == 0

0 commit comments

Comments
 (0)