mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
Merge pull request #2802 from Kristy-an/master
fix python block code highlight problem
This commit is contained in:
@ -185,7 +185,7 @@ class Solution:
|
|||||||
|
|
||||||
> 版本二:针对版本一的优化
|
> 版本二:针对版本一的优化
|
||||||
|
|
||||||
```python3
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def nextGreaterElements(self, nums: List[int]) -> List[int]:
|
def nextGreaterElements(self, nums: List[int]) -> List[int]:
|
||||||
res = [-1] * len(nums)
|
res = [-1] * len(nums)
|
||||||
|
@ -254,6 +254,7 @@ directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]
|
|||||||
def bfs(grid, visited, x, y):
|
def bfs(grid, visited, x, y):
|
||||||
que = deque([])
|
que = deque([])
|
||||||
que.append([x,y])
|
que.append([x,y])
|
||||||
|
visited[x][y] = True
|
||||||
while que:
|
while que:
|
||||||
cur_x, cur_y = que.popleft()
|
cur_x, cur_y = que.popleft()
|
||||||
for i, j in directions:
|
for i, j in directions:
|
||||||
|
@ -261,10 +261,10 @@ public class Main {
|
|||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
# 处理输入
|
# 处理输入
|
||||||
n, m = list(map(int, input().strip()))
|
n, m = list(map(int, input().split()))
|
||||||
g = []
|
g = []
|
||||||
for _ in range(n):
|
for _ in range(n):
|
||||||
row = list(map(int, input().strip()))
|
row = list(map(int, input().split()))
|
||||||
g.append(row)
|
g.append(row)
|
||||||
|
|
||||||
# 定义四个方向、孤岛面积(遍历完边缘后会被重置)
|
# 定义四个方向、孤岛面积(遍历完边缘后会被重置)
|
||||||
|
Reference in New Issue
Block a user