Lunatic Server Solutions Interview Question Developer Program Engineers

  • lunatic-server-solutions-interview-questions
    0
    of 0 votes
    0
    Answers

    Consider a service counter. People waiting for service form a queue. At the start, the queue is empty and
    time is 0. The service time per person is 3 minutes.
    The input to the program consists of an integer N followed by a sequence of integers indicating the arrival
    time (in minutes) of the customers. These times are given as offset from the start of the simulation, so that an
    input of 44 means 44 minutes from the start of simulation. The sequence of input numbers is terminated by
    the number -1.
    Your program must simulate the queue and print out the following:
    1. The number of customers waiting in the queue at time = N minutes from the start of simulation.
    2. The arrival times of the customers in the queue at that time, in increasing order.
    Each integer must be separated by a space. Terminate your output with a newline character.
    For doing the computation, you can assume that if the counter is expected to be vacant at time t, the first
    person in the queue will be scheduled for service, before the counting is done for time t.
    You must use the queue data structure to solve this problem.
    Sample Input/Output
    Input
    9 0 2 5 6 6 8 10 -1
    Output
    2 6 8

    - PriyaDarad on May 22, 2012 in United States Report Duplicate | Flag
    Lunatic Server Solutions Developer Program Engineer Data Structures

Country: United States
Interview Type: Written Test




Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More