Data Structures & AlgorithmsHardTCS NQT · Accenture
Customers arrive at times 0, 1, 2 and 5 and need service times 3, 2, 1 and 2 on a single server (first come, first served; a customer starts when both arrived and the server is free). At what time does the last customer finish?
- A. 9
- B. 8
- C. 10
- D. 12
Correct answer: B. 8
The finishes are 3, 5, 6 and 8: each customer starts at the later of its arrival time and the previous finish.
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
- For the same four customers (arrivals 0, 1, 2, 5; service times 3, 2, 1, 2) on a single first-come-first-served server, what is the…
- A list holds 1 to 9 in order. The first 4 nodes are reversed, then the node with value 6 is deleted. What is the value at position 5 of…
- How many contiguous subarrays of [1, 2, -3, 3, -3, 2, 1] have sum exactly zero?
- How many index pairs i < j in [1, 3, 5, 7, 9, 4] have |a[i] - a[j]| = 2?
- How many distinct values appear among the XORs of all non-empty contiguous subarrays of [1, 2, 3]?
- How many windows of length 3 in the string abaaabaa are anagrams of aab (same letters with the same counts)?