23. Count More than n/k Occurrences
Last updated
Last updated
The problem can be found at the following link: Question Link
To solve this problem, I use a map
to store the frequency of each element. I then iterate through the map and count the elements that occur more than n/k
times.
Time Complexity : O(n), where n is the size of the array.
Auxiliary Space Complexity : O(n), for the map.
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star
to the getlost01/gfg-potd repository.