Medium data structure and algorithm practice puzzle.
Given a list where deps[i] names what service i needs, and one service that has just failed, return how many services end up down including that one. A service is down when anything it depends on is down, so the failure propagates in the opposite direction to the dependency arrows. This is the number nobody computes until the incident, and it is the argument for a dependency graph you can actually query.
Solve it three ways: snap the jigsaw pieces together, fill in the blanks, or type it from scratch against the tests. This one is free.
Browse all 536 puzzles