All pastes #74340 Raw Edit

Mine

public text v1 · immutable
#74340 ·published 2006-06-28 22:22 UTC
rendered paste body
    max_negative = 0
    prev_end = None
    combined = []
    for start, size in offsets:
        if start < 0:
            max_negative = min(start, max_negative)
        else:
            end = start + size - 1
            if prev_end is None:
                combined.append([start, end])
            elif start <= prev_end + 1 + fudge_factor:
                combined[-1][1] = end
            else:
                combined.append([start, end])
            prev_end = end
    return combined, -max_negative