Array Smoothening (60/100)

This commit is contained in:
2022-05-25 14:44:20 +02:00
parent d0599df035
commit 7cd7b069bc

13
arraysmoothening.py Normal file
View File

@@ -0,0 +1,13 @@
_, k = map(int, input().split())
a = list(map(int, input().split()))
u = set(a)
c = {}
for v in u:
c[v] = len([x for x in a if x == v])
for _ in range(k):
m = max(c, key=c.get)
c[m] -= 1
print(max(c.values()))