Compute a Ticket SLA Deadline Across Business Hours and Pauses

Last updated: November 29, 2026

Quick Overview

Given a ticket's start time, an SLA measured in business minutes, a weekly schedule of open windows, a set of holidays, and intervals when the SLA clock is paused (waiting on the employee), return the exact deadline.

Moveworks
Coding & Algorithms
Software Engineer
Moveworks
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given a ticket's start time, an SLA measured in business minutes, a weekly schedule of open windows, a set of holidays, and intervals when the SLA clock is paused (waiting on the employee), return the exact deadline.

When an assistant files or triages a ticket it often tells the employee when to expect a response, and those promises are computed from each customer's business calendar. The interviewer checks interval arithmetic under several overlapping constraints and whether you test the tricky boundaries (start after hours, lunch gaps, pauses spanning windows).

What the Interviewer Expects
  • Clarifies time zone, inclusive or exclusive boundaries, and pause semantics
  • Iterates day by day over open windows, clipping the first day at the start time
  • Subtracts pause intervals from each window correctly
  • Returns mid-window as soon as remaining time is consumed
  • Guards against schedules with no open hours
Key Topics to Cover
Interval arithmetic
Datetime handling
Calendars
Simulation
Edge-case testing
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 make this fast for a 90-day SLA without iterating every day?
  • A tenant spans time zones and the SLA follows the assignee's calendar; what changes?
  • How do daylight-saving transitions break naive datetime arithmetic here?
  • How would you compute 'percentage of SLA elapsed' for a dashboard in real 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

All datetimes are naive in the tenant's local zone (convert at the boundary). schedule[weekday] is a list of (open, close) windows, allowing a lunch break. Holidays have no hours. Pauses stop the ...

High-Level Design

Walk forward one day at a time. For each window, clip its start to max(window_open, start), subtract any pause intervals to get unpaused segments, and consume each segment. If a segment is at least ...


Submit Your Answer
Markdown supported

Related Questions