Question
A single-threaded program runs `n` functions identified by ids `0..n-1`. You are given execution logs as strings `"{id}:{start|end}:{timestamp}"` in chronological order; a function may call others (nested) and may recurse. The exclusive time of a function is the total time spent in it not counting time spent in nested calls. `start` happens at the beginning of a timestamp and `end` at the end of a timestamp, so `0:start:0` then `0:end:0` is 1 unit. Return the exclusive time of each function, indexed by id.
exclusive_time(n: int, logs: list[str]) → list[int][2,["0:start:0","1:start:2","1:end:5","0:end:6"]]out[3,4]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.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.