Skip to content

Conversation

@2023111432
Copy link

学号:2023111432

修改思路:
1.修正了数组大小错误
数组大小应该是26,而不是25
2.修复了循环逻辑错误导致的跨界访问
原本的循环会尝试获取s[lenth]处的字符
3. 修复计数数组初始化逻辑错误
原代码使用 num[s.charAt(i) - 'a']-- 错误记录负次数
修正为 num[s.charAt(i) - 'a']++ 正确记录正次数

  1. 调整字符处理顺序
    在判断是否跳过重复字符前先减少剩余次数
    确保弹出条件判断准确

测试结果:
12个测试用例全部通过
包括题目示例和多种边界情况
代码逻辑正确,性能符合要求

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant