@@ -0,0 +1,766 @@
+def merge_ranges(meetings):%0A    sorted_meetings = sorted(meetings)%0A    merged_meetings = %5B%5D%0A%0A    previous_meeting_start, previous_meeting_end = sorted_meetings%5B0%5D%0A%0A    for current_meeting_start, current_meeting_end in sorted_meetings%5B1:%5D:%0A        if current_meeting_start %3C= previous_meeting_end:%0A            previous_meeting_end = max(current_meeting_end, previous_meeting_end)%0A        else:%0A            merged_meetings.append((previous_meeting_start, previous_meeting_end))%0A            previous_meeting_start, previous_meeting_end = %5C%0A                current_meeting_start, current_meeting_end%0A%0A    merged_meetings.append((previous_meeting_start, previous_meeting_end))%0A%0A    return merged_meetings%0A%0Ameetings = %5B(1, 2), (1, 5), (7, 8)%5D%0Aprint merge_ranges(meetings)%0A

Add merge ranges