Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import Counter
- def findMinimumDistinct(A, N, K):
- mp = Counter(A)
- count = 0
- length = 0
- counts = []
- for i in mp:
- counts.append(mp[i])
- counts = sorted(counts)
- counts.reverse()
- for i in range(len(counts)):
- if (length >= K):
- break
- length += counts[i]
- count += 1
- print(count)
- N,K = map(int,input().split())
- A = list(map(int,input().split()))
- findMinimumDistinct(A, N, K)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement