Reported July 2026
Googlesorting

Consolidated 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 July 2026 OA report has a scheduling problem that looks like interval merging and isn't. You get on-call rotations as "name,start,end" strings and have to output segments where the set of people on call stays the same. It's a sweep line over start and end events, with a sorted active set. The catch is in the details: half-open intervals, gaps, and the same person appearing twice. If you've got an OA coming, this is the pattern to recognize in the first two minutes. StealthCoder sits invisibly behind the assessment as a safety net if the sweep logic slips on the day.

The problem

You are given on-call rotations. Each rotation contains a person name, a start time, and an end time, and represents the half-open interval [start, end).
Produce the consolidated on-call schedule. Each output segment must be a maximal contiguous time range during which the set of people on call does not change. Omit gaps where no one is on call.
Input rotations are provided as strings formatted "name,start,end". Return strings formatted "start,end,name1,name2,...", with names in lexicographic order inside each segment.

Function
getOnCallSchedule(rotations: String[]) → String[]
Complete getOnCallSchedule.
String rotations[n]: on-call intervals
Returns String[]: consolidated schedule segments sorted by start time.

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.
Example 2
rotations = ["Nina,1,3","Omar,5,7"]
return = ["1,3,Nina","5,7,Omar"]
The gap from 3 to 5 has no on-call person and is omitted.

Constraints
0 <= rotations.length <= 10^5
0 <= start < end <= 10^9
Names contain no commas.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is a sweep line. Parse each rotation into two events: add the name at start, remove it at end. Sort all event times, then walk through the distinct times. At each time, apply every event at that timestamp before you emit anything. Between consecutive times, if the active set is non-empty, output "prev,curr,names" with names sorted. The edge case that breaks naive solutions: ends and starts at the same time. Because intervals are [start, end), a person ending at 40 must be removed when another begins at 40, and you must process all events at that timestamp together or you'll emit zero-length segments. Also, use a count per name, not a plain set, in case one person has overlapping rotations. With n up to 10^5, re-sorting the active names per segment can get expensive, so keep a sorted structure. If you blank mid-assessment, StealthCoder is the hedge that can hand you the sweep skeleton.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Consolidated 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Consolidated On-Call Rotations FAQ

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

Turn each rotation into a start event and an end event, sort by time, and sweep. Between two consecutive distinct timestamps the active set is constant, so each gap between timestamps is one candidate segment. Skip it if nobody is on call. Sort names inside each segment.

Why do half-open intervals matter here?+

Because [start, end) means a person is off call exactly at their end time. At any timestamp, apply all removals and additions together before emitting the next segment. If you handle them one by one, you'll output empty or wrong segments at boundaries like 40 in Example 1.

Do I need to merge adjacent segments with the same people?+

The problem says segments are maximal ranges where the set doesn't change, so if two adjacent segments end up with identical sets, merge them. This can happen when one person leaves and another with the same name joins at the same time. Check the previous output before appending.

What complexity should I aim for with 10^5 rotations?+

Sorting 2n events is O(n log n). The risk is output size and per-segment name sorting. Keep the active names in an ordered structure, like a sorted map with counts, so each update is logarithmic. Building the output string still costs the size of the active set.

How do I prepare for this in 48 hours?+

Write a sweep line from scratch twice: once for counting overlaps, once tracking a set of active items. Then practice the same-timestamp batching and gap handling. Test with Example 2, where a gap must be omitted, and with duplicate names or an empty input.

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