If you are given an array of numbers between 1 and 100 and an integer n
, you must remove any instances of an item that appear greater than n
times.
For example:
In : [92, 41, 81, 47, 28, 92, 84, 92, 81], n = 1
Out: [92, 41, 81, 47, 28, 84]
The most aesthetic/simple algorithm wins. And since this is a popularity-contest, you get to decide!