# 1481. Least Number of Unique Integers after K Removals
[leetcode](https://leetcode.com/problems/least-number-of-unique-integers-after-k-removals/description/?envType=daily-question&envId=2024-02-16)

去掉K位後 arr最少的整數
由於他需要去掉重複最少的數k位
所以我們可以使用hashmap的概念
將key設為整數 value設為重複幾次
設queue來排序我們的value
在將整數k-重複 就有答案
```
class Solution {
public int findLeastNumOfUniqueInts(int[] arr, int k) {
Map <Integer,Integer> count = new HashMap<>();
for (final int a:arr){
count.merge(a,1,Integer::sum);
}
Queue <Integer> heap = new PriorityQueue<>(count.values());
while(k > 0){
k -= heap.poll();
}
return heap.size() + (k < 0?1 : 0);
}
}
```