Find Gaps In A Control's Passing History Across An Audit Window

Last updated: November 29, 2026

Quick Overview

Given timestamped test runs (pass or fail) for one control, an audit window [start, end), and a rule that a pass only proves the control until the next run or for at most max_gap hours, return the windows where the control was not proven passing and the percent of the window it was.

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

0

0

0 solved


Given timestamped test runs (pass or fail) for one control, an audit window [start, end), and a rule that a pass only proves the control until the next run or for at most max_gap hours, return the windows where the control was not proven passing and the percent of the window it was.

A SOC 2 Type II report covers a period of time, so Vanta must show not just that a control passes today but that it held throughout the audit window. This problem checks interval reasoning: clipping, staleness when runs stop arriving, and the off-by-one traps of half-open intervals.

What the Interviewer Expects
  • Sorts runs and derives a proven interval per passing run
  • Caps proof at max_gap so a stalled runner is not counted as passing
  • Clips intervals to the audit window, including runs before start
  • Computes complementary gap intervals correctly
  • Uses half-open intervals consistently
Key Topics to Cover
intervals
sorting
clipping
half-open ranges
staleness
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 compute this for 2,000 controls across 10,000 tenants every night?
  • An integration was disconnected for six hours. Should that gap count against the customer?
  • How would you store run history compactly when 99% of hourly runs repeat the previous result?
  • How would you let an auditor sample specific points in 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

Runs are (t, passed) in hours. A pass at t proves the control on [t, min(next_run, t + max_gap)). Anything not covered, whether a fail or a silent period, is a gap. Return gaps inside `[start, e...

High-Level Design

Sort runs, drop runs at or after end, and for each passing run produce its proof interval clipped to the window. A run before start still counts if its proof extends into the window. Because runs ...


Submit Your Answer
Markdown supported

Related Questions