Tap here to switch tabs
Problem
Submissions

Problem: Reduce Array Size to The Half

med
30 min
Try to solve the Reduce Array Size to The Half problem.

Statement

Given an integer array arr, you can choose a set of integers and remove all occurrences of these integers from the array.

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

Constraints:

  • 2≤2 \leq arr.length ≤105\leq 10^5

  • arr.length is even.

  • 1≤1 \leq arr[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reduce Array Size to The Half

med
30 min
Try to solve the Reduce Array Size to The Half problem.

Statement

Given an integer array arr, you can choose a set of integers and remove all occurrences of these integers from the array.

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

Constraints:

  • 2≤2 \leq arr.length ≤105\leq 10^5

  • arr.length is even.

  • 1≤1 \leq arr[i] ≤105\leq 10^5