Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Non-unique Elements by Taras1991
#Your optional code here
#You can import some modules or create additional functions
from collections import Counter
def checkio(data):
# Initializing the counter will count elements by default.
counter = Counter(data)
# we go through the list again to maintain order. We could optimize more if
# order did not matter.
return [ x for x in data if counter[x]>1 ]
May 7, 2014
Comments: