Array Smoothening (60/100)
This commit is contained in:
13
arraysmoothening.py
Normal file
13
arraysmoothening.py
Normal 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()))
|
||||||
Reference in New Issue
Block a user