How to write a code that returns a list with all elements that occurred N times removed?
I'm trying to write a python function duplicate(elem, N) which returns a copy of the input list with all elements that appeared at least N times removed. The list can't be sorted. For example ((2, 2, 2, 1, 2, 3, 4, 4, 5), 2) would return (1,3,5).