Operational time of fucntions

bhaiya i have not understood appaoch of this question… could u explain in the form of pseudocode

The way to solve this problem is to create a gantt chart first. If you have already studied about Gantt charts in Operating systems, this is a straightforward question.

However if not, the approach is to take an auxiliary array of size N, where arr[i-1] denotes the time spent by function i in the singlethreaded CPU.
Next sort the logs according to the timestamp. This will provide a serial order to your functions as your CPU is single threaded.
Finally take an boolean variable that denotes whether the CPU is free or not. If it is free, straightaway start the next process. Else remove the process executing in cpu and update its execution time in the arr.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.