mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-01 17:53:18 +08:00
fix:range issue (#496)
This commit is contained in:
@@ -11,7 +11,7 @@ type CountingSort struct{}
|
||||
func countingSortNaive(nums []int) {
|
||||
// 1. 统计数组最大元素 m
|
||||
m := 0
|
||||
for num := range nums {
|
||||
for _, num := range nums {
|
||||
if num > m {
|
||||
m = num
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func countingSortNaive(nums []int) {
|
||||
func countingSort(nums []int) {
|
||||
// 1. 统计数组最大元素 m
|
||||
m := 0
|
||||
for num := range nums {
|
||||
for _, num := range nums {
|
||||
if num > m {
|
||||
m = num
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user