Amazon | Onsite | Runtimes of Process
Anonymous User
1351

I was asked this question in one of the rounds which I believe to be a bar riser because of the minimum info provided and also the open-endedness of it. I bombed it :(

Given 'x' runtime it takes for a process to complete, return the time at which the process will complete. Design an Algorithm

Info gathered from follow up questions:

  1. Number of machines m, each machine can run only one process at time - Single thread.
  2. Goal is to find a machine that can quickly pick up the process.
  3. In case if all the machines are busy, add the process to the queue of a machine that will be freed first.
  4. All the runtimes are whole numbers greater than 0.

While the more I thought about it, it sounded like an variation of Meeting rooms problem https://leetcode.com/problems/meeting-rooms-ii/. Please share your thoughts.

Comments (4)