Data Structures & AlgorithmsModerateTCS NQT Digital · Infosys

Problem: Five customers with service times 5, 3, 8, 2, 4 (in arrival order) are served by two tellers. Each customer goes to whichever teller becomes free first (ties go to teller 1), and all arrive at time 0. What is the time at which the last customer finishes?

  1. A. 22
  2. B. 17
  3. C. 11
  4. D. 7

Correct answer: C. 11

Teller 1 takes 5, teller 2 takes 3; at t = 3 teller 2 takes 8 (ends 11); at t = 5 teller 1 takes 2 (ends 7) and then 4 (ends 11), so the last finish is 11. A single teller would need 22, alternating customers between tellers gives teller 1 5 + 8 + 4 = 17, and 7 is only customer 4's finish.

More Coding Interview Problems questions

Exams that ask this topic