Minimal Number of Distinct Values to Remove Half of an Array

Given an integer array arr, you may choose distinct integer values. When a value is chosen, all occurrences of that value must be removed.

Return the minimum number of distinct values that must be ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: