Given an array
Nintegers and an integer
K, print the smallest number in the array which occurs exactly
Input : N = 5, K = 2 arr = [2, 2, 1, 3, 1] Output : 1 (both 1 & 2 occurs 2 times but 1 < 2)
With reference to competitive programming course online, Store the frequency of all elements in a temporary
(1to Size of Hash array
)and whenever the frequency of an element matches with
K, print it and return.