Exclusive Time of Functions
CodingPhone ScreenSoftware EngineerReported Dec, 2025
Examples
Example 1:
Input: n = 2, logs = ["0:start:0","1:start:2","1:end:5","0:end:6"]
Output: [3,4]
Example 1:
Input: n = 2, logs = ["0:start:0","1:start:2","1:end:5","0:end:6"]
Output: [3,4]
On a single-threaded CPU, you are given execution logs for n functions. Each log entry has the format "{function_id}:{start|end}:{timestamp}".
Return the exclusive time spent in each function, excluding the time spent in nested child calls.
1 <= n <= 1001 <= logs.length <= 500Reported as LeetCode 636 in a software engineer phone screen.