1481. Least Number of Unique Integers after K Removals (Medium) - TengnanYao/daily_leetcode GitHub Wiki
class Solution(object):
def findLeastNumOfUniqueInts(self, arr, k):
"""
:type arr: List[int]
:type k: int
:rtype: int
"""
h = collections.Counter(arr)
heap = h.values()
heapq.heapify(heap)
while heap and heap[0] <= k:
k -= heapq.heappop(heap)
return len(heap)