Baseline 2: a time for everyone
AI off This is a baseline exam. The tutor is switched off and there are no hints. Work alone, the way you would with no assistant open. Nothing here is a trick: every rule is written in the exercise. Your result is only compared with your own final exam at the end of the course.
A scheduling service finds the next time a whole team can meet. Each person's calendar lives in a separate store, and every entry fetched costs a network call, so the service is billed by entries read. Teams are large and calendars go back years.
A small example
from creative.budget import Tape
cals = [[(0, 30), (60, 90)], [(10, 40)], []]
earliest_slot([Tape(c) for c in cals], 0, 15) # -> 40 (free from 40 to 60)
earliest_slot([Tape(c) for c in cals], 0, 20) # -> 40 (40 + 20 = 60: touching is fine)
earliest_slot([Tape(c) for c in cals], 0, 25) # -> 90Write earliest_slot(calendars, after, length). calendars is a list of Tapes, one per person. Each holds that person's meetings as (start, end) minute pairs, sorted by start; a meeting is busy from start up to but not including end, and one person's meetings never overlap (they may touch). Return the earliest minute t >= after such that nobody is busy anywhere in [t, t + length). Everyone is free after their last meeting, so there is always an answer.
Budget: there are 50 people with 2,000 meetings each (100,000 entries), and after is usually months into the data. One search may read at most 10,000 entries in total. len() of a Tape is free. A Tape behaves like a read-only list (indexing, slicing and looping all work), and every entry it hands you counts as one read.
AI off: no tutor, hints or worked solution on this one. Your own thinking only.
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.