Elements Appearing More Than N/K Times
Mediumjavapythonccppjavascript
Given an array of N elements and an integer K, find every value that occurs more than N / K times (integer division).
Input Format
The first line contains two integers N and K. The second line contains N space-separated integers.
Output Format
Print the qualifying values in increasing order, separated by single spaces. If there are none, print an empty line.
Example 1
Input
6 3 1 1 1 2 2 3
Output
1
Explanation: N/K = 2. Only 1 appears more than 2 times.
- 1 <= N <= 100000
- 2 <= K <= 100000
- -1000000000 <= A[i] <= 1000000000