Implement a streaming logger and two query operations for test runs with globally strictly increasing timestamps.
-
Implement log(test_id, timestamp, status) where status ∈ {'failing','passing'}.
-
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.
-
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.