Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA
Four jobs given as (deadline, processing time) are (2, 3), (4, 2), (5, 6), (7, 4) and run one after another from time 0. Order them by earliest deadline. What is the maximum lateness (completion minus deadline, at least 0)?
- A. 10
- B. 15
- C. 8
- D. 16
Correct answer: C. 8
EDD order (2,3), (4,2), (5,6), (7,4) completes at 3, 5, 11, 15, with lateness 1, 1, 6, 8, so the maximum is 8. Shortest-processing-time order gives 10, 16 is the total lateness, and 15 the final completion time.
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
- What is the length of the longest substring of "pwwkewbcab" with no repeated characters?
- How many integers from 1 to 200 inclusive are divisible by 4 or by 6 but not by 12?
- A pancake flip reverses a prefix of length at least 2. What is the minimum number of prefix flips needed to sort [3, 1, 2] into increasing…
- How many non-empty subsets of [1, 2, 3, 4, 6] have a sum divisible by 3?
- How many distinct value-pairs (x, y) with x <= y occur as a[i] + a[j] = 5 for some indices i < j in [1, 1, 2, 2, 3, 3, 4, 5]?
- What is the lexicographically largest substring of length 2 in "zebraqzyx"?