All pastes #74337 Raw Edit

Mine

public text v1 · immutable
#74337 ·published 2006-06-28 22:19 UTC
rendered paste body
prev_end = None

for start, size in offsets:
    if start < 0:
        max_negative = min(start, max_negative)
    else:
        end = start + size - 1
        if prev_end is None:
            combinend.append([start, end])
        elif start <= prev_end + 1:
            combined[-1][1] = end
        else:
            combined.append([start, end])
        prev_end = end