Data Structures & AlgorithmsHardTCS NQT · Accenture
A bank of 4 workers each processes one task per minute, and tasks arrive as a queue. In a single pass over the array of task lengths [3, 1, 2, 5, 4, 1], each task goes to the worker who is free earliest. What is the finishing time of the whole job in minutes?
- A. 6
- B. {C+5}
- C. 5
- D. 8
Correct answer: C. 5
Assign each task in turn to the earliest-free worker, then take the maximum finish time. The makespan is not the sum divided by four.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many subarrays of [3, 1, 4, 1, 5] have their minimum equal to their first element?
- What is the minimum possible value of the largest sum among the two groups when the array [7, 2, 5, 10, 8] is split into two contiguous…
- How many indices i in [1, 500] satisfy both that i is divisible by 3 and that i+1 is divisible by 5?
- What is the number of occurrences of the substring ana in bananaanana, counting overlapping occurrences?
- How many index pairs i < j in [1, 2, 3, 2, 1, 4] have a[i] + a[j] equal to 3 or to 6?
- How many distinct cells are visited when a robot starts at (0, 0) and makes the moves R, U, R, D, L, U, U (R: x+1, L: x-1, U: y+1, D…