Build a Combined People Schedule
Problem statement
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.