FastPrepConsolidated On-Call Rotations
Problems/Consolidated On-Call Rotations

Consolidated On-Call Rotations

Google logoGoogle● MediumOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This came from a real Google coding challenge report. The original report shared the interval consolidation task, table example, and pseudocode; FastPrep filled in a simple string-array runner format so you can try it here. Estimated match rate: 95%+ for the core task, 70-80% for exact wording and runner details. If you find a fuller version, feel free to let us know and we will update it.

You are given a list of on-call rotations. Each rotation has a person's name, a start time and an end time. The person is on call from the start time up to, but not including, the end time. That is the half-open interval [start, end).

Build the combined on-call schedule. Split the time when someone is on call into segments. Inside one segment, the group of people on call never changes. Make each segment as long as possible. Leave out any gap when no one is on call.

Each input rotation is a string in the form "name,start,end". Return each segment as a string in the form "start,end,name1,name2,...". Inside a segment, list the names in lexicographic order, which means comparing them as strings.

Function

getOnCallSchedule(rotations: String[]) → String[]

Complete getOnCallSchedule.

  • String rotations[n]: the on-call rotations

Returns String[]: the 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 same 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"]

Nina is on call until 3 and Omar starts at 5. No one is on call in that gap, so it is left out of the schedule.

Constraints

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

More Google Online Assessment questions

  • Book Reading EveningsOA · Seen Nov 2026
  • Count Score CategoriesOA · Seen Nov 2026
  • Minimum Cars for Rental RequestsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Shortest Path in a Binary MatrixOA · Seen Nov 2026
  • Robot Assembly Line ConflictsOA · Seen Oct 2026
  • Assign LockerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Biggest Number From DigitsOA · Seen Oct 2026
  • Consolidate On-Call RotationsOA · PHONE SCREEN · Seen Oct 2026
  • Decreasing SubsequencesOA · Seen Sep 2026
  • Minimize Absolute Difference of Server LoadsOA · Seen Sep 2026

Similar questions at other companies

  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Process SchedulerGoldman Sachs · OAGoldman Sachs interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
  • Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
  • Minimum Meeting Rooms with AssignmentsUber · PHONE SCREEN · ONSITE INTERVIEWUber interview questions
  • Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions

Interview reports that mention this question

  • Google OA: What It Tests (2026)

Google interview experiences

  • Google L5 Security Engineer Domain Knowledge Round: 1 Experience
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] getOnCallSchedule(String[] rotations) {
      // write your code here
    }
}
Checking account…