From e5ebc38dddeb6a356f892d7e3d930f9f257790b1 Mon Sep 17 00:00:00 2001 From: Kristy-an Date: Mon, 21 Oct 2024 21:12:06 -0500 Subject: [PATCH 1/3] fix python block code highlight problem --- problems/0503.下一个更大元素II.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0503.下一个更大元素II.md b/problems/0503.下一个更大元素II.md index 5751bb91..056b7096 100644 --- a/problems/0503.下一个更大元素II.md +++ b/problems/0503.下一个更大元素II.md @@ -185,7 +185,7 @@ class Solution: > 版本二:针对版本一的优化 -```python3 +```python class Solution: def nextGreaterElements(self, nums: List[int]) -> List[int]: res = [-1] * len(nums) From d64a5359383d7d1fe399b33f2319f7253cd131f7 Mon Sep 17 00:00:00 2001 From: HONGYAN ZHAO Date: Thu, 24 Oct 2024 21:07:17 -0500 Subject: [PATCH 2/3] Debug python version, change strip() to split() --- problems/kamacoder/0101.孤岛的总面积.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/kamacoder/0101.孤岛的总面积.md b/problems/kamacoder/0101.孤岛的总面积.md index 26c92c07..408501ff 100644 --- a/problems/kamacoder/0101.孤岛的总面积.md +++ b/problems/kamacoder/0101.孤岛的总面积.md @@ -261,10 +261,10 @@ public class Main { from collections import deque # 处理输入 -n, m = list(map(int, input().strip())) +n, m = list(map(int, input().split())) g = [] for _ in range(n): - row = list(map(int, input().strip())) + row = list(map(int, input().split())) g.append(row) # 定义四个方向、孤岛面积(遍历完边缘后会被重置) From 492f45f53d6e46bfed1d91cc91fe0a3d91964ead Mon Sep 17 00:00:00 2001 From: HONGYAN ZHAO Date: Thu, 24 Oct 2024 21:08:52 -0500 Subject: [PATCH 3/3] debug python version, set visited[x][y] to True in the beginning of bfs --- problems/kamacoder/0099.岛屿的数量广搜.md | 1 + 1 file changed, 1 insertion(+) diff --git a/problems/kamacoder/0099.岛屿的数量广搜.md b/problems/kamacoder/0099.岛屿的数量广搜.md index 9d31c922..522e19c3 100644 --- a/problems/kamacoder/0099.岛屿的数量广搜.md +++ b/problems/kamacoder/0099.岛屿的数量广搜.md @@ -254,6 +254,7 @@ directions = [[0, 1], [1, 0], [0, -1], [-1, 0]] def bfs(grid, visited, x, y): que = deque([]) que.append([x,y]) + visited[x][y] = True while que: cur_x, cur_y = que.popleft() for i, j in directions: