Given a list of log entries describing function calls, each formatted as "<id> <event> <timestamp>" where event ∈ {START, END} and timestamps are integers, compute the exclusive execution time for every function ID assuming calls may be nested and logs are in chronological order. Return a mapping id → exclusive_time. Follow-ups:
(
-
Adapt the solution if timestamps can be equal and some entries may be slightly out of order; describe how to correct or buffer the stream online.
(
-
Given a stream of categorical events (e.g., ERROR/WARN/INFO), detect the earliest index where the same value appears N consecutive times and return that window’s start index, or −1 if none. Analyze time and space complexity.