Get Function Execution Time

Problem Overview

  • Compute exclusive execution time for n functions on a single-thread CPU using preemptive logs.
  • Input: n and logs id:start|end:timestamp; Output: int array of times for IDs 0..n-1, including start and end seconds.
  • Logs sorted with non-decreasing timestamps; each start has a matching end; 1≤n≤100, 1≤m≤500.
  • Context: task scheduling and profiling in preemptive systems.
  • From Capital_one interviews; a coding interview question/problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: