This question evaluates a candidate's ability to design efficient data structures and algorithms for time-series event logging, interval computation, and tracking concurrent failure states across distinct identifiers.
Design a data structure that supports:
log(testId, timestamp, status) — record the status ('pass'/'fail') of a test run; timestamps are strictly increasing across all test IDs.
getMinFixTime(testId) — for the given testId, return the shortest duration from the first failure in any contiguous failure block to the next passing status; return null if the test never moves from failing to passing.
Follow-up: Extend the same logging function and implement getMaxConcurrentFailures(min_tests) — return the longest contiguous time interval [start, end) during which at least min_tests distinct tests are simultaneously failing (specific test IDs don't matter). Return an object {start_timestamp, end_timestamp} with end exclusive.