I'm studying algorithms and one of the questions asks me to build an in-house calendar tool which stores data as a tuple of integers. My goal is to write a function that takes a list of multiple meeting time ranges and returns a list of condensed ranges.
So far, I've written pseudo-code and some real code. However, I'm trying to append overlapping times (represented as integers) and I'm stuck. Here's what I have so far:
# Variable containing list of tuples
meeting_times = [(0, 1), (3, 5), (4, 8), (10, 12), (9, 10)]
# Sort meetings by start time
ordered_list = sorted(meeting_times)
# For each number in the variable
for m in range(ordered_list):
# If number overlaps with another number in variable
if m[0:] >= m[:-1]:
# Append start time of first number to end time of last number
append_meeting_time =
else:
# Continue on and loop through variable.
While it's not complete, I'd like to know if I'm the right path. If not, how can I improve my answer?