VOOZH about

URL: https://www.geeksforgeeks.org/interview-experiences/fiberlink-maas360-interview-set-2-written-test-question/

⇱ Fiberlink (maas360) Interview | Set 2 (Written Test Question) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Fiberlink (maas360) Interview | Set 2 (Written Test Question)

Last Updated : 2 Mar, 2015
Write a function "runCustomerSimulation" that takes two inputs - an integer: total number of computers in a cafe and a string: a sequence of uppercase letters. Letters in the sequence occur in pairs. The first occurrence indicates the arrival of a customer; the second indicates the departure of that same customer. A customer will be serviced if there is an unoccupied computer. No letter will occur more than two times. Customers who leave without using a computer always depart before customers who are currently using the computers. There are at most 20 computers per cafe. Output: For each set of input the function should output a number telling how many customers, if any walked away without using a computer. Return 0 if all the customers were able to use a computer. runCustomerSimulation (2, "ABBAJJKZKZ") should return 0 runCustomerSimulation (3, "GACCBDDBAGEE") should return 1 runCustomerSimulation (3, "GACCBGDDBAEE") should return 0 runCustomerSimulation (1, "ABCBCA") should return 2
Comment