[Week 1] MeetWith smart calendar feature

You have been contracted to build the MeetWith feature of a smart calendar. Given the schedules of n persons, MeetWith is able to recommend an appropriate time to organize a meeting between all the persons involved, taking their current schedules into consideration.

def meet_with(schedules, persons, no_meeting_before, no_meeting_after):
	return possible_meeting_times
schedule = {
	kofi: [[9, 11], [15, 18]], # busy 9-11 and 15-18
	ama: [[11, 13]], # busy 11-13
	joe: [[8, 10], [16, 19]], # busy 8-10 and 16-19
}

meet_with(
	schedule=schedule,
	persons=[kofi, ama],
	no_meeting_before=6,
	no_meeting_after=21
)

Ok here are my thoughts on this:

  • First get the current schedules of the people in the meeting
  • Then find the delta between their current schedule
  • Consider the before and after time with the delta
  • Then Profit :rofl:

Here is a link to my solution https://repl.it/@silentworks/MeetWith

Assumptions:

  • we should be able to start a meeting when one’s busy schedule ends but not during

  • [11-13] would mean meeting starts at 11:00 ends at 13:00

Solution
https://repl.it/repls/SoupyDarkvioletInitialization