mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-04 11:44:21 +00:00
build
This commit is contained in:
@@ -27,9 +27,7 @@ comments: true
|
||||
"""计数排序"""
|
||||
# 简单实现,无法用于排序对象
|
||||
# 1. 统计数组最大元素 m
|
||||
m = 0
|
||||
for num in nums:
|
||||
m = max(m, num)
|
||||
m = max(nums)
|
||||
# 2. 统计各数字的出现次数
|
||||
# counter[num] 代表 num 的出现次数
|
||||
counter = [0] * (m + 1)
|
||||
|
||||
Reference in New Issue
Block a user