Get Minimum Removals (Fungible :)
Problem Overview
- Compute the minimum number of removals from an integer array so the final array has at most max_distinct distinct values.
- Input: data[n] (1 ≤ n ≤ 1e5, values up to 1e9) and max_distinct; Output: an integer count of removals.
- Context: data pruning in an Amazon prototype service used by data analysts.
- Source: Amazon interviews; a coding interview problem and practical interview question focused on array and distinct elements.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
