FastPrepBuild a Combined People Schedule
Problems/Build a Combined People Schedule

Build a Combined People Schedule

Google logoGoogle● MediumFULLTIMENEW GRADONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report gives the task and interview context. The callable signature, deterministic tie-breaking, examples, and bounds are source-faithful reconstruction details; estimated fidelity is 90%.

Each half-open schedule entry is [name,start,end], with integer times written as decimal strings.

Return every maximal segment between consecutive distinct boundaries from the minimum start to the maximum end as [start,end,commaSeparatedNames]. Include gaps with an empty name string. Within a segment, names follow their first input-row order. The active-person count for a segment is the number of names in commaSeparatedNames, or zero when that string is empty.

Function

buildCombinedSchedule(roster: String[][]) → String[][]

Examples

Example 1

roster = [["Mary","10","40"],["John","30","50"],["Peter","50","80"],["Crystal","100","150"],["Jane","120","180"]]return = [["10","30","Mary"],["30","40","Mary,John"],["40","50","John"],["50","80","Peter"],["80","100",""],["100","120","Crystal"],["120","150","Crystal,Jane"],["150","180","Jane"]]

The result splits at every start or end and includes the 80-to-100 gap.

Example 2

roster = [["A","0","5"]]return = [["0","5","A"]]

One entry creates one segment.

Example 3

roster = []return = []

An empty roster creates no segments.

Constraints

  • 0 <= roster.length <= 5000.
  • start < end.

More Google problems

  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[][] buildCombinedSchedule(String[][] roster) {
        // write your code here
    }
}
Checking account…