← 返回 uber 的题目列表Exclusive Time of Functions
类型:qbank
On a single-threaded CPU, given execution logs for n functions, compute the exclusive time spent in each function, excluding time spent in nested child calls.
Exclusive Time of Functions
On a single-threaded CPU, given execution logs for n functions, compute the exclusive time spent in each function, excluding time spent in nested child calls.
SWE
stack
simulation
parsing
medium
Frequency
Single report
Last asked
2026-04-05
Stage
phone-screen
Exclusive Time of Functions
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.
Examples
Example 1:
Input: n = 2, logs = ["0:start:0","1:start:2","1:end:5","0:end:6"]
Output: [3,4]
Constraints
1 <= n <= 100
1 <= logs.length <= 500
Log entries are guaranteed to be valid.