1
class Solution:
2
def minSetSize(self, arr: List[int]) -> int:
3
n = len(arr)
4
half = n // 2
5

6
c = Counter(arr)
7
s = 0
8
ans = 0
9

10
for num, occurances in c.most_common():
11
s += occurances
12
ans += 1
13
if s >= half:
14
return ans
15
return ans

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0