Reported June 2026
Googlesorting

Consolidate On-Call Rotations

Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Google OA. Under 2s to a working solution.
Founder's read

Google's June 2026 OA reportedly includes Consolidate On-Call Rotations, and the trap is easy to miss. Two rotations can touch at a boundary, like one ending at 40 while another starts at 40, and a naive merge glues or splits them wrong. It's a sweep line over half-open intervals with a set of active names. With up to 2 * 10^5 rows, brute force won't pass. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and gives you the sweep structure. Know the idea first, though. It's short once you see it.

The problem

You are given a list of on-call rotations. Each rotation has a name, start time, and end time, representing a half-open interval [start, end) during which that person is on call.
Produce the consolidated on-call timeline as maximal contiguous segments. In each output segment, the set of on-call people must remain constant throughout the entire interval. Sort segments by start time and omit gaps where nobody is on call.
Represent each input row as [name, start, end]. Return each output row as [start, end, names], where names is a comma-separated list of on-call names in lexicographic order.

Function
consolidateOnCallRotations(rotations: String[][]) → String[][]

Examples
Example 1
rotations = [["A", "10", "50"], ["B", "20", "60"], ["C", "30", "40"], ["D", "30", "40"]]
return = [["10", "20", "A"], ["20", "30", "A,B"], ["30", "40", "A,B,C,D"], ["40", "50", "A,B"], ["50", "60", "B"]]
The original interview report presents this example as input and output tables.
Input rotations
namestartend
A1050
B2060
C3040
D3040
Consolidated schedule
startendnames
1020A
2030A, B
3040A, B, C, D
4050A, B
5060B
The active set changes at times 10, 20, 30, 40, 50, and 60.

Constraints
1 <= rotations.length <= 2 * 10^5
Each row is [name, start, end].
0 <= start < end <= 10^9
Multiple rotations may share the same start or end time.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Turn each rotation into two events: add the name at start, remove it at end. Sort all events by time. Walk through them, and at each distinct time, first emit the segment from the previous time to this time if the active set is non-empty, then apply every event at this time. Process all events sharing a timestamp together, or you'll emit zero-length segments. Because intervals are half-open, an end at 40 and a start at 40 both apply at 40, so the person leaving and the person arriving never overlap. Keep a sorted structure for names, or sort when emitting. Pitfall: two adjacent segments with the same set should be maximal, but a change in membership always means a new segment, so check if a remove and add of the same name at one time cancels out. If it does, merge the segments. StealthCoder is the hedge if the live OA rattles you on that edge case.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Consolidate On-Call Rotations cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Google's OA.

Google reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Consolidate On-Call Rotations FAQ

What's the trick in Consolidate On-Call Rotations?+

Sweep line. Convert each rotation into a start event and an end event, sort by time, and maintain the active set of names. Emit a segment between consecutive distinct timestamps whenever the set is non-empty. Group all events at the same timestamp before emitting.

What edge case breaks the naive solution?+

Events sharing a timestamp. If you process them one at a time you emit zero-length segments or wrong sets. Also, a name that ends and restarts at the same time should not split the segment, so compare the set before and after and merge when unchanged.

How hard is this really?+

Medium. The sweep idea is standard, but the grouping of same-time events and half-open handling trip people up. With 2 * 10^5 rows you need O(n log n), so sorting events is fine and nested loops over intervals are not.

Is this pattern still asked at Google?+

Interval sweeps show up often, and this one was reported in June 2026. Related ideas include merge intervals, meeting rooms, and skyline style problems. Learn the event-sorting approach once and it transfers to all of them.

How do I prepare in 48 hours?+

Write this sweep from scratch twice. Test inputs with duplicate starts, duplicate ends, touching intervals, and gaps. Practice emitting names in lexicographic order and formatting the comma-joined string. Then do one merge-intervals and one meeting-rooms problem for muscle memory.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Google.

OA at Google?
Invisible during screen share
Get it