Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Compress List by freixodachamorra
def compress(x):
if len(x) == 0:
return []
else:
return [x[0]] + [x[i] for i in range(1, len(x)) if x[i] != x[i-1] ]
Jan. 31, 2020