Code RoomDistinct outage count
EasyPrep Room Coding #521

Distinct outage count

CodingAlgorithms & data structuresEntry–Mid~10 min

An uptime checker probes a site once a minute and stores the results in order as a list of strings, each "up" or "down". For the monthly report you need the number of distinct outages: an outage is a maximal run of consecutive "down" results — it starts when a "down" follows an "up" (or begins the list) and ends at the next "up" (or the end of the list). Return the number of outages; an empty list has zero.

Implement
count_outages(statuses: list[str]) → int
Examples
in[["up","down","down","up","down"]]out2
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 10 min
InputExpectedGot
[["up","down","down","up","down"]]2not run yetsample