Input: arr[ ] = [3, 4, 2, 2, 1, 2, 3, 3], k = 4
Output: [2, 3]
Explanation: Here n/k is 8/4 = 2, therefore 2 appears 3 times in the array that is greater than 2 and 3 appears 3 times in the array that is greater than 2
Input: arr[ ] = [9, 10, 7, 9, 2, 9, 10], k = 3
Output: [9]
Explanation: Here n/k is 7/3 = 2, therefore 9 appears 3 times in the array that is greater than 2.
Consider k = 4, n = 9
Given array: 3 1 2 2 2 1 4 3 3
i = 0
temp[] has one element {3} with count 1
i = 1
temp[] has two elements {3, 1} with counts 1 and 1 respectively
i = 2
temp[] has three elements, {3, 1, 2} with counts as 1, 1 and 1 respectively.
i = 3
temp[] has three elements, {3, 1, 2} with counts as 1, 1 and 2 respectively.
i = 4
temp[] has three elements, {3, 1, 2} with counts as 1, 1 and 3 respectively.
i = 5
temp[] has three elements, {3, 1, 2 with counts as 1, 2 and 3 respectively.
i = 6
temp[] has two elements, {1, 2} with counts as 1 and 2 respectively.
i = 7
temp[] has three elements, {3, 1, 2} with counts as 1, 1 and 2 respectively.
i = 8
temp[] has three elements, {3, 1, 2} with counts as 2, 1 and 2 respectively.