1051. Height Checker
Содержание
class Solution:
def heightChecker(self, heights: List[int]) -> int:
cnt = [0] * 101
for h in heights:
cnt[h] += 1
res = i = 0
for j in range(1, 101):
while cnt[j]:
cnt[j] -= 1
if heights[i] != j:
res += 1
i += 1
return res