def merge_intervals(items):
    if not items:
        return []
    merged = []
    for start, end in sorted(items):
        if merged and start <= merged[-1][1] + 1:
            merged[-1][1] = max(merged[-1][1], end)
        else:
            merged.append([start, end])
    return merged
