Code RoomService failure blast radius
EasyPrep Room Coding #4723

Service failure blast radius

CodingAlgorithms & data structuresEntry–Mid~16 min

A release tool keeps the call graph of a service fleet. Each entry in `calls` is a string like "web>auth", meaning the service named on the left calls the one named on the right, so the left service stops working when the right one does. On-call has just taken `failed` out of rotation, and every service that reaches it through a chain of calls goes dark with it. Return that blast radius: the affected service names, sorted alphabetically. Leave `failed` itself out of the answer, even when a chain of calls loops back to it. The fleet may contain cycles, repeated entries and a service that calls itself, and `failed` may not appear in `calls` at all.

Implement
outage_blast_radius(calls: list[str], failed: str) → list[str]
Examples
in[["web>auth","auth>db","billing>db","web>cdn"],"db"]out["auth","billing","web"]
in[["web>auth","auth>db","billing>db","web>cdn"],"cdn"]out["web"]
in[[],"db"]out[]
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 16 min
InputExpectedGot
[["web>auth","auth>db","billing>db","web>cdn"],"db"]["auth","billing","web"]not run yetsample
[["web>auth","auth>db","billing>db","web>cdn"],"cdn"]["web"]not run yetsample
[[],"db"][]not run yetsample