From d33c76e74aa90b8ba319af04b0c7f731f6bfabca Mon Sep 17 00:00:00 2001 From: 01geek Date: Wed, 9 Oct 2024 16:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=20problems/1047.=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=AD=E7=9A=84=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9B=B8=E9=82=BB=E9=87=8D=E5=A4=8D=E9=A1=B9.md=20?= =?UTF-8?q?=E4=B8=ADjava=E7=89=88=E6=9C=AC=E7=9B=B8=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=EF=BC=9A=E5=B0=86top>0=E7=BA=A0=E6=AD=A3=E4=B8=BAtop>?= =?UTF-8?q?=3D0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/1047.删除字符串中的所有相邻重复项.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/1047.删除字符串中的所有相邻重复项.md b/problems/1047.删除字符串中的所有相邻重复项.md index 7232008a..51ec4e62 100644 --- a/problems/1047.删除字符串中的所有相邻重复项.md +++ b/problems/1047.删除字符串中的所有相邻重复项.md @@ -164,7 +164,7 @@ class Solution { int top = -1; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); - // 当 top > 0,即栈中有字符时,当前字符如果和栈中字符相等,弹出栈顶字符,同时 top-- + // 当 top >= 0,即栈中有字符时,当前字符如果和栈中字符相等,弹出栈顶字符,同时 top-- if (top >= 0 && res.charAt(top) == c) { res.deleteCharAt(top); top--;