Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
a0, b0 = next(intervals) solution in Clear category for Merge Intervals (iterator version) by flpo
def merge_intervals(intervals):
a0, b0 = next(intervals)
for a, b in intervals:
if a > b0 + 1:
yield a0, b0
a0, b0 = a, b
elif b0 < b:
b0 = b
yield a0, b0
Sept. 6, 2018