Code review: review a log parser that calculates time spent in a function.
Asked in the code review stage. Listed as an example from the code review question bank.
Implement exclusive_time(n, logs). Each log has the form "function_id:start:timestamp" or "function_id:end:timestamp". Logs are properly nested. For every function ID, return the sum of inclusive durations, where an invocation ending at end after starting at start contributes end - start + 1 time units. Return a list of length n, ordered by function ID.
def exclusive_time(n, logs):