Skip to content

Commit a6f86e6

Browse files
committed
jump game
1 parent 036f23e commit a6f86e6

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

jump-game.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# https://leetcode.com/problems/jump-game/
2+
3+
class Solution:
4+
def canJump(self, nums: List[int]) -> bool:
5+
6+
if nums is None:
7+
return False
8+
9+
curr = len(nums) - 1
10+
i = curr
11+
12+
while i>=0:
13+
if nums[i] >= curr - i:
14+
curr = i
15+
16+
i-=1
17+
18+
if curr:
19+
return False
20+
else:
21+
return True
22+

word-search.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://leetcode.com/problems/word-search/submissions/
1+
# https://leetcode.com/problems/word-search/
22

33
class Solution:
44
def DFS(self,row, col, curr, board, word):
@@ -24,7 +24,7 @@ def exist(self, board: List[List[str]], word: str) -> bool:
2424
for col in range(len(board[0])):
2525

2626
check = self.DFS(row, col, 0, board, word)
27-
27+
2828
if check:
2929
return True
3030

0 commit comments

Comments
 (0)