Problem
Pick a set of values and delete every occurrence of each picked value from arr. Return the minimum size of the set that removes at least half of the elements.
Example 1
- Input
- arr = [3, 3, 3, 3, 5, 5, 5, 2, 2, 7]
- Output
- 2
- Why
- remove 3 and 5: 3 elements left
Example 2
- Input
- arr = [7, 7, 7, 7, 7, 7]
- Output
- 1
Example 3
- Input
- arr = [1, 2, 3, 4]
- Output
- 2
Constraints
2 <= arr.length <= 10^5arr.length is even.1 <= arr[i] <= 10^5