Company: Amazon_4th june_on campus _iit guwahti
Difficulty: medium
Executing Processes There are n processes waiting on a CPU, indexed from 0 to n-1 . Process i has priority priorities[i] , and a smaller numeric value means a lower priority. The CPU runs the processes one at a time in reverse index order: index n-1 first, then n-2 , and so on down to index 0 . Each process takes one unit of time, so process n-1 starts at time 0 , process n-2 starts at time 1 , and in general process i starts at time n-1-i . A process is starved if some process with a lower priority runs before it. Its starvation period begins when the earliest of those lower-priority processes starts running and ends when the process itself starts running. The starvation time is the length of that period, measured in time units. A process with no lower-priority process running before it has a starvation time of 0 . Report the starvation time of every process. The task is exposed as a function findStarvation that takes the array priorities and returns the array of starvation times. Inp