1: On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1.
2: You are required to find the total execution time of each function.
3: You are given len number of logs, where logs[i] represents the ith log message formatted as a string "{function_id}:{"start" | "end"}:{timestamp}", telling start or end time of function with id function_id.
Note that a function can be called multiple times, possibly recursively.Input Format
A number n representing number of functions. A number len representing count of logs. log1 log2 ...len number of logs.
Output Format
print in different lines Exclusive Time Of Functions from id 0 to n-1.
Constraints
1: 1 <= n <= 100 2: 0 <= function_id < n 3: No two start events will happen at the same timestamp. 4: No two end events will happen at the same timestamp. 5: Each function has an start time and an end time.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
2 4 0:start:0 1:start:2 1:end:5 0:end:6
Output
3 4