Google phone screen | L4

Anonymous User
678
Feb 11, 2025
Feb 18, 2025

You are given a list of jobs, the time they are submitted at, and the amount of time it takes to do them.
The program should print the start, and end time of each job, as if the OS had scheduled them using FCFS.

Sample Input:
P1 submission_time=0 execution_time=5
P2 submission_time=5 execution_time=10

Follow-up
We now also have priority of each process. One with the highest priority should be executed first.
But the CPU should pick lower priority process if it's idle. Process which is picked up will be executed completely.

Solved the initial one with a basic priorityQueue.
Messed up on the follow-up question. Came up with a complicated non-optimal solution and coded it with maybe couple of bugs.

What are my chances?

Update: Rejected

Comments (4)