Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
simple solution in Clear category for Merge Intervals by StefanPochmann
def merge_intervals(intervals):
result = []
for interval in intervals:
if not result or interval[0] > result[-1][1] + 1:
result.append(interval)
result[-1] = result[-1][0], max(result[-1][1], interval[1])
return result
July 25, 2017
Comments: