Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
group_equal_consecutive solution in Clear category for Group Equal consecutive by dannedved
def group_equal(els):
if len(els) == 0:
return []
result = [[els[0]]]
for item in els[1:]:
if item == result[-1][-1]:
result[-1].append(item)
else:
result.append([item])
return result
Sept. 1, 2019