Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
﴾ ̲◦̲ / ̅•̅ ﴿ ̮ ‿( ́ ̵ _-`)‿ ̮ solution in Clear category for Merge Intervals by vmiimu
def merge_intervals(d):
res = [d[0]] if d else d
for i,curr in enumerate(d[1:]):
if curr[0] <= res[-1][1]+1:
res[-1] = (res[-1][0],max(res[-1][1],*curr))
else:
res.append(curr)
return res
Dec. 28, 2018
Comments: