Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 558f253

Browse files
committed
Time: 348 ms (72.65%) | Memory: 17.9 MB (35.93%) - LeetSync
1 parent 8891977 commit 558f253

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎55-jump-game/jump-game.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def canJump(self, nums: List[int]) -> bool:
3+
#code here
4+
arr = nums
5+
cur = 0
6+
maxi = 0
7+
8+
while maxi < len(arr)-1:
9+
if cur > maxi:
10+
return False
11+
12+
# check cur arr
13+
if arr[cur]+cur > maxi:
14+
maxi = arr[cur]+cur
15+
16+
cur +=1
17+
return True

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /