Code Room
CodingEasycod-g1333
Subject Log processingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.