Process On-Call Routing Operations
Updated
Problem statement
Manage on-call rotations by processing the operations in order. Each operation is an array of strings.
["SET_ROTATION", team, responder1, ...]assigns a nonempty ordered list of distinct responders to the team, replaces any earlier rotation, resets the active responder to the first entry, and returns"OK".["ADVANCE", team]moves a known team to its next responder, wrapping from the last responder back to the first, and returns that responder. For an unknown team it returns"NONE".["ROUTE", team]returns the current active responder, or"NONE"for an unknown team.
Return one result string per operation in input order. An unknown-team operation leaves all state unchanged.
Function
processOnCallRouting(operations: String[][]) → String[]Examples
Example 1
operations = [["SET_ROTATION","api","amy","bo"],["ROUTE","api"],["ADVANCE","api"],["ROUTE","api"],["ADVANCE","api"]]return = ["OK","amy","bo","bo","amy"]The active responder advances cyclically through the team's ordered rotation.
Example 2
operations = [["ROUTE","missing"],["SET_ROTATION","web","lee"],["SET_ROTATION","web","sam","zoe"],["ROUTE","web"]]return = ["NONE","OK","OK","sam"]Unknown teams return NONE, and replacing a rotation resets its active position.
Constraints
1 <= operations.length <= 100000- At most
100000team-responder memberships appear across all rotation assignments. - Team and responder identifiers are nonempty strings of letters, digits, hyphens, or underscores with length at most
40. - Each assigned rotation contains distinct responders.
More OpenAI Phone Screen questions
- Secret Number Search with One-Call-Delayed FeedbackPHONE SCREEN · Seen Nov 2026
- Determine the Winner of Three-Card HandsPHONE SCREEN · Seen Nov 2026
- Grid Infection with Recovery After D DaysPHONE SCREEN · Seen Nov 2026
- Sparse Plant Infection SimulationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Light Source Hits: Sample, Compare, and FitPHONE SCREEN · Seen Nov 2026
- Rectangle Point Coverage CountsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Adaptive Calibration ErrorPHONE SCREEN · Seen Nov 2026
- Elevator Scheduling SimulationPHONE SCREEN · Seen Nov 2026
- Evaluate Noisy AnnotatorsPHONE SCREEN · Seen Oct 2026
- Network Endpoint or Cycle BoundaryOA · PHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
- Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
- Role-Based Network Access ControlOkta · PHONE SCREENOkta interview questions
- Track Package Receipt GapsAmazon · PHONE SCREEN
- Transformer KV Cache OperationsNVIDIA · PHONE SCREENNVIDIA interview questions
- Rate Limiter with Hourly and Daily Effort QuotasZscaler · PHONE SCREENZscaler interview questions
- Chatter Message WindowReddit · PHONE SCREENReddit interview questions
- Versioned Recipe Shopping CartDecagon · PHONE SCREENDecagon interview questions
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions