Integer Modification (contest)
Integer Modification (contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Integer Modification (contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You care given an array A having N integers. Find the minimum number of integers you would have to modify from the array so that there are at most K distinct integers in the array. Input The first line of the input contains two integers, N and K. The second line of the input contains N space seperated integers.
Constraints: 1 <= K <= N <= 105 1 <= Ai <= N Output Print the minimum number of integers you would have to modify from the array so that there are at most K distinct integers in the array. Example Sample Input 5 2 1 1 2 2 6
Sample Output: 1
link: