# LeetCode 1338. Reduce Array Size to the half

## Question

Given an array `arr`

. You can choose a set of integers and remove all the occurrences of these integers in the array.

Return *the minimum size of the set* so that **at least** half of the integers of the array are removed.

**Example**

1 | Input: arr = [3,3,3,3,5,5,5,2,2,7] |

## Solution

Sorting and then delete the number which with maximum frequency.

## Code

1 | // time:O(nlogn) space:O(n) |