Back to problems

Consolidate On-call Rotations into Maximal Constant Segments

Algorithm · Google · Hard

You receive a collection of on-call assignments. Every assignment has the form {name, start, end} and denotes the half-open period [start, end) when that person is responsible for on-call coverage. Generate a merged on-call schedule made up of segments with these properties: An emitted segment must be a maximal continuous interval [s, e) over which the group of on-call people does not change. List all resulting segments in increasing order of start. Do not output time ranges…

Checking your access…