Shortest Call Window That Completes the Compliance Script in Order
Last updated: November 29, 2026
Quick Overview
Each utterance in a call is tagged with at most one compliance step label (or none). Given a required ordered list of steps, return the shortest contiguous range of utterances that contains the steps as a subsequence, or report that none exists.
Cresta
November 29, 20260
0
0 solved
Each utterance in a call is tagged with at most one compliance step label (or none). Given a required ordered list of steps, return the shortest contiguous range of utterances that contains the steps as a subsequence, or report that none exists.
In regulated contact centers (collections, insurance, banking) Cresta's quality tooling checks that required script steps happened in order, and highlighting the tightest span helps a reviewer audit quickly. The interviewer wants an O(n times m) dynamic programming solution rather than restarting a scan from each start, and correct handling of repeated step labels.
What the Interviewer Expects
- Recognize this as minimum window subsequence
- Track the latest feasible start for each prefix of the steps
- Iterate steps in reverse so one utterance satisfies at most one step
- Return indices, not just a length
- Analyze O(n m) time and O(m) space
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you allow one utterance to satisfy several steps at once?
- How would you allow up to one missing optional step?
- How would you report every non-overlapping compliant window in a long call?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: labels, length , each a step id or None; steps, length , may repeat labels (for example verify twice). Output: (start, end) inclusive of the shortest window where steps appear i...
High-Level Design
Keep start[j]: among windows ending at or before the current index that contain steps[0..j] as a subsequence, the latest possible start. When the current label equals steps[j], extend the match ...