fix: problems/220.contains-duplicate-iii.md #525
Merged
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.
虽然C++的代码能通过leetcode的所有测试用例,但其仍存在bug:
当擦除hashmap中的元素时,键的计算方法应该和插入时的计算方法一致。否则会错误地擦除需要的元素或者保留不需要的元素。
例如:
输入:nums = [-1,10,20,1], k = 2, t = 3
预期结果:false
实际输出:true
解释:当i = 3时, 删除了nums[i-k]/mod = 0的键,但实际上值"-1"存储在键为-1的桶中,造成i=4时的错误判断。