You get per-minute counts [minute, requests, errors] (minutes ascending, possibly with gaps — a missing
minute has zero requests). An alert fires at minute m when the error rate over the window
[m - window + 1, m] (sum of errors / sum of requests) is ≥ threshold and the window had at least
min_requests requests. It resolves at the first later minute where the condition is false.
Evaluate every minute from the first to the last given minute. Return [[fired_at, resolved_at], ...];
use None for resolved_at if the alert is still firing at the last minute.
Implement alert_periods. Input: counts: list[[int, int, int]], window: int, threshold: float, min_requests: int. Returns: list[list].
Minute 3 still includes minute 2's errors (30/200 = 15%); minute 4's window has none.
def alert_periods(counts, window, threshold, min_requests):
return []
Run executes the public tests. Submit grades against public and hidden tests.
You get per-minute counts [minute, requests, errors] (minutes ascending, possibly with gaps — a missing
minute has zero requests). An alert fires at minute m when the error rate over the window
[m - window + 1, m] (sum of errors / sum of requests) is ≥ threshold and the window had at least
min_requests requests. It resolves at the first later minute where the condition is false.
Evaluate every minute from the first to the last given minute. Return [[fired_at, resolved_at], ...];
use None for resolved_at if the alert is still firing at the last minute.
Implement alert_periods. Input: counts: list[[int, int, int]], window: int, threshold: float, min_requests: int. Returns: list[list].
Minute 3 still includes minute 2's errors (30/200 = 15%); minute 4's window has none.
def alert_periods(counts, window, threshold, min_requests):
return []
Run executes the public tests. Submit grades against public and hidden tests.