From bae8298c8a5d6efa85c73b0495c1c13fe54a5706 Mon Sep 17 00:00:00 2001 From: ZeYanLin Date: Mon, 15 May 2023 14:57:08 +0800 Subject: [PATCH] fix:range issue (#496) --- codes/go/chapter_sorting/counting_sort.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/go/chapter_sorting/counting_sort.go b/codes/go/chapter_sorting/counting_sort.go index 5d23334a6..a1322347a 100644 --- a/codes/go/chapter_sorting/counting_sort.go +++ b/codes/go/chapter_sorting/counting_sort.go @@ -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 }