Skip to content

Commit 2d5a196

Browse files
Solve : Jump Game
1 parent 45f0bc9 commit 2d5a196

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

jump-game/printjin-gmailcom.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def canJump(self, nums):
3+
max_reach = 0
4+
for i in range(len(nums)):
5+
if i > max_reach:
6+
return False
7+
max_reach = max(max_reach, i + nums[i])
8+
return True

0 commit comments

Comments
 (0)