← Questions

Find the first error in a log, then trace failures through dependencies

0
SnowflakeCodingLast asked Sep 2025
  1. A service's log lines are tagged Info, Warn or Error. Once the first Error appears the service is down, so every later line is an Error too, and the line just before the first Error is always a Warn. Find the first Error line with binary search.
  2. Follow-up: services depend on each other, and a failed service brings down the services that depend on it. Given the dependency graph and the services that failed first, find every service that ends up failing (and, if asked, when), using BFS.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding