Data Structures & AlgorithmsHardTCS NQT · Accenture
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 average waiting time in whole minutes (waiting = start minus arrival, average rounded down)?
- A. 2
- B. 3
- C. 1
- D. 5
Correct answer: C. 1
The waits are 0, 2, 3 and 1, summing to 6; 6 divided by 4 gives 1.5, which rounds down to 1. Waiting is measured from arrival, not from 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
- 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)?
- What is the length of the longest substring of aabaaccaa that contains at most two letters 'a'?