FastPrepConsolidate On-Call Rotations
Problems/Consolidate On-Call Rotations

Consolidate On-Call Rotations

Google logoGoogleFULLTIMEOAPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

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 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.

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.

Source note: Interview prompt excerpt preserved as source evidence.

More Google Online Assessment questions

  • Minimum Cars for Rental RequestsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Operations to Make a SubsequenceOA · Seen Nov 2026
  • Book Reading EveningsOA · Seen Nov 2026
  • Count Score CategoriesOA · 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
  • Decreasing SubsequencesOA · Seen Sep 2026
  • Minimize Absolute Difference of Server LoadsOA · Seen Sep 2026

Interview reports that mention this question

  • Google OA: What It Tests (2026)

Google interview experiences

  • Google interviews · November 2026
  • 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[][] consolidateOnCallRotations(String[][] rotations) {
      // write your code here
    }
}
Checking account…