Given an arry A (may contain duplicates) of N elements and a positive integer K. The task is to count the number of elements which occurs exactly floor(N/K) times in the array.
Hint: You may use hashing or brute-force.
Input: 5 2 1 4 1 2 4 Output: 2 Explanation: In the given array, 1 and 4 occurs floor(5/2) = 2 times. So count is 2.
Input: 3 2 99 66 66 Output: 1 Explanation: In the given array, 99 occurs floor(3/2) = 1 time. So count is 1.
1 <= N <= 103
1 <= Ai <= 103
Your task is to complete the function countSpecials() which should count the elements which occurs exactly floor(N/K) times.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.