Compute Incident SLA Due Time Across Business Hour Schedules

Last updated: November 29, 2026

Quick Overview

Given an incident's start time, an SLA duration in business minutes, a weekly schedule of working windows per weekday, and a set of holiday dates, return the exact datetime when the SLA breaches. Time outside working windows and on holidays does not count toward the SLA.

ServiceNow
Coding & Algorithms
Software Engineer
ServiceNow
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given an incident's start time, an SLA duration in business minutes, a weekly schedule of working windows per weekday, and a set of holiday dates, return the exact datetime when the SLA breaches. Time outside working windows and on holidays does not count toward the SLA.

SLA definitions in IT Service Management run against schedules (for example 9 to 5 weekdays with a lunch break) and holiday calendars, so a priority 2 incident opened late on Friday does not breach over the weekend. In a coding screen in this style, the interviewer checks whether you can model time windows cleanly, walk the calendar without off-by-one errors, and reason about edge cases such as starting inside a break or on a holiday.

What the Interviewer Expects
  • Clarify the schedule representation, time zone assumptions and what happens when the SLA ends exactly at a window close
  • Walk day by day and window by window, consuming remaining minutes instead of stepping minute by minute
  • Handle a start time inside a window, inside a break, before opening, or on a non-working day
  • Guard against schedules with no working time so the loop cannot run forever
  • State time complexity in terms of days spanned and windows per day
  • Test with weekend and holiday crossings
Key Topics to Cover
Interval arithmetic
Calendar iteration
Datetime handling
Edge case analysis
SLA modeling
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you support pausing the SLA while the incident is in an On Hold state, given a list of pause intervals?
  • The SLA is 2,000 business hours long. How do you avoid walking every day one at a time?
  • How would you handle schedules defined in the caller's time zone across a daylight saving change?
  • Given the due time, how would you compute percentage elapsed for a progress bar at an arbitrary current time?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Inputs: start (naive datetime in the schedule's time zone), minutes of business time, schedule mapping weekday 0 (Monday) to 6 to a sorted list of non-overlapping (open_minute, close_minute) w...

High-Level Design

Keep a cursor: the current date plus a minute-of-day offset (the start minute on the first day, 0 afterwards). For each non-holiday day, iterate its windows. Clip each window's open to the cursor offs...


Submit Your Answer
Markdown supported

Related Questions