0164.Maximum Gap基数排序中缺少计数器更新导致BUG
pench3r opened this issue · 1 comments
pench3r commented
原代码:
for i := len(nums) - 1; i >= 0; i-- {
tmp := count[(nums[i]/exp)%10]
tmp--
aux[tmp] = nums[i]
}
缺少计数器更新,应更新为:
for i := len(nums) - 1; i >= 0; i-- {
tmp := count[(nums[i]/exp)%10]
tmp--
aux[tmp] = nums[i]
count[(nums[i]/exp)%10] = tmp
}