Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
2022112452
语法错误修复:
补充缺少的分号(如 put('T', 3) 后添加 ;)。
修正声明错误,将 List ans[] 改为 List ans。
修正循环中 i === 0 为 i = 0。
使用 s.length() 替代 s.length 以正确调用字符串的长度方法。
逻辑错误修复:
确保位操作正确,去掉无效的括号,将 {x << 2} 改为 (x << 2)。
确保滑动窗口的实现逻辑正确,移动计算与哈希映射的结合。
代码规范改进:
初始化变量时使用泛型简化:new ArrayList<>()。
确保测试条件合理,例如长度不足 10 时直接返回结果。
整体验证:
修复后,确保功能符合题意,即返回长度为 10 的所有重复 DNA 子序列。