Skip to content

Instantly share code, notes, and snippets.

@hectorj2f
Created July 16, 2021 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hectorj2f/4205a38ff126adf1ac6689572d73670f to your computer and use it in GitHub Desktop.
Save hectorj2f/4205a38ff126adf1ac6689572d73670f to your computer and use it in GitHub Desktop.
Given two people calendars, find the blocks of time when both can attend to a meeting.
Drew's spare blocks of time: [[10:00, 11:30], [12:30, 14:30], [14:30, 15:00]]
Drew begins his day at 10:00 and leaves at 18:30, ([10:00, 18:30]).
Julian's spare blocks of time: [[09:00, 10:30], [12:00, 13:00], [16:00, 18:00]]
Julian begins his day at 09:00 and leaves at 20:00, ([09:00, 20:00]).
Expected Result:
* Slot: 10:00 -- 10:30
* Slot: 12:30 -- 13:00
Goal: Write a function that returns the list of blocks of time when to schedule a meeting between them.
Notes:
* You can assume the times are sorted
* You can expect valid inputs
* 3pm is 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment