Design streaming test logger and queries
Company: Vanta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Implement a streaming logger and two query operations for test runs with globally strictly increasing timestamps.
1) Implement log(test_id, timestamp, status) where status ∈ {'failing','passing'}.
2) Implement get_min_fix_time(test_id) -> number|null: For the specified test, return the minimal duration from the start of a failing state to the next subsequent passing state. If multiple failing statuses occur consecutively, treat them as a single failure starting at the first failure; if the failure never resolves to passing, or the test never fails, return null.
3) Implement get_max_concurrent_failure_period(min_tests) -> {start_timestamp, end_timestamp}|null: Return the longest contiguous period [start_timestamp, end_timestamp) during which at least min_tests distinct tests are failing simultaneously; if no such period exists, return null. Assume timestamps are integers and strictly increasing across all log calls. Describe your data structures, algorithms, and time/space complexities.
Quick Answer: This question evaluates a candidate's ability to design streaming data structures and time-series algorithms to track state transitions and compute interval queries, covering competencies in online/event-processing algorithms, interval overlap aggregation, and algorithmic complexity analysis within the Coding & Algorithms domain.