Amazon | Phone | SDE2
Anonymous User
3795

Q1 -
You are given a list of job difficulties for a construction site worker and number of days to complete all the jobs.
You need to find the minimum difficulty to finish all the jobs.
Following are the conditions for job allocation:

  1. Jobs have to be done sequentially, i.e. for any ith job, all jobs less than i have to be done.
  2. Difficulty for the day is the maximum job difficulty for that day.
  3. You need to have atleast 1 job 1 day.

Example :
[6,1,2,5,4], n = 3
Output - 12 (day1 = 6, day2 = 1, day3 = 2,5,4)

Q2 -
You are given a list of tasks and the dependent tasks which have to be completed before given task.
You need to output the order in which tasks should be scheduled.

Example:
Input - [[1,0],[2,0],[3,1],[3,2]]
Output - 0,1,2,3
Explanation :
Task 1 is dependent on task 0
Task 2 is dependent on task 0
Task 3 is dependent on task 1 and 2.
So you should finish 0th task first, followed by 1/2 or 2/1, followed by task 3.

Comments (7)