<doocs>0057.Insert Interval_1.py
def merge(intervals):
    intervals.sort()
    ans = []
    st, ed = intervals[0]
    for s, e in intervals[1:]:
        if ed < s:
            ans.append([st, ed])
            st, ed = s, e
        else:
            ed = max(ed, e)
    ans.append([st, ed])
    return ans
def sample_funcname ( var_0 ) :
    var_0.sort ( )
    var_2 = [ ]
    var_4 , var_5 = var_0 [ 0 ]
    for var_7 , var_8 in var_0 [ 1 : ] :
        if var_5 < var_7 :
            var_2.append ( [ var_4 , var_5 ] )
            var_4 , var_5 = var_7 , var_8
        else :
            var_5 = max ( var_5 , var_8 )
    var_2.append ( [ var_4 , var_5 ] )
    return var_2
