Company: Deutsche_Bank_26nov
Difficulty: medium
Minimum Deletions to Make Frequencies Unique Problem Description An array A consisting of N integers is given. Our goal is to obtain an array in which every value occurs a unique number of times. We only consider integers that appear at least once in the resulting array. To achieve the goal, we can delete some integers from A . What is the minimum number of integers that must be deleted from A so that every remaining value occurs a unique number of times? Write a function: class Solution { public int solution(int[] A); } that, given an array A consisting of N integers, returns the minimum number of integers that must be deleted from it so that every remaining value occurs a unique number of times. Examples Example 1: Input: A = [1, 1, 1, 2, 2, 2] Output: 1 Explanation: We can delete one occurrence of 1 or one occurrence of 2. After this operation, one value will occur three times and the other one two times. Example 2: Input: A = [5, 3, 3, 2, 5, 2, 3, 2] Output: 2 Explanation: After de