From ace597085dd73614c2a4790794abc0a4a350e59a Mon Sep 17 00:00:00 2001 From: Buzz-HIT <302840154@qq.com> Date: Thu, 13 Nov 2025 11:45:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B90115.=E7=BF=BB=E8=BD=AC?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=AD=E7=9A=84=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit python语言版本中版本四第19行(整体markdown491行):应该先判断fast < len(s)再判断s[fast] != " ",否则提交后会出现数组越界错误 --- ...\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" "b/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" index b5246a7dbb..a5aabb96a5 100755 --- "a/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" +++ "b/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" @@ -492,7 +492,7 @@ class Solution: if s[fast] != " ": if len(result) != 0: result += " " - while s[fast] != " " and fast < len(s): + while fast < len(s) and s[fast] != " ": # 交换顺序会出现数组越界 result += s[fast] fast += 1 else: