You are given three related sub-problems about error detection and propagation.
A) Log search: You have a chronologically ordered array of log lines. Each line starts with one of the exact prefixes "[Info]", "[Warn]", or "[Error]". Guarantees: after the first "[Error]" appears, every subsequent line is an "[Error]"; immediately before the first "[Error]" there is at least one "[Warn]". Find the index of the first "[Error]" using as few reads as possible. Implement the function and state time and space complexities. Clarify what you return if no error exists.
B) Failure fan-out: You are given a directed service dependency graph where an edge U -> V means "U calls V". When a service fails, all upstream callers that depend on it eventually fail. Given the ID of the first failing service and the graph (e.g., as an adjacency list of callers-to-callees), output the set of all services that will eventually fail (order not important). Describe and implement an algorithm and analyze its complexity.
C) Longest failure chain (follow-up): Using the same graph and initial failing service, output one of the longest error-propagation chains starting from that service (i.e., an ordered list of services describing a longest path of cascading failures along the propagation direction). State any assumptions about cycles (e.g., treat the graph as a DAG or search for the longest simple path), justify your choice, and provide the algorithm with complexity analysis.