Microsoft | Phone | LRU & Ticket Reservation
Anonymous User
5281

Question #1 : LRU

Question #2: You are designing a ticket purchasing system for an upcoming concert. Implement two functions:

  1. String getReservationNumber() -- returns a String of the reservation number for a given ticket.
  2. Boolean confirmReservation (String reservationNumber) -- returns true or false depending on whether the ticket was confirmed within N (say 30) seconds.

Conditions:

  • You have a limited number of tickets (say 100) and should keep track of how many have been confirmed. If the ticket has not been confirmed within the time limit, it's reservation number will become available again to the next customer.

Follow up:

  1. How would you scale this to a venue that sits thousands? (I said threads)
  2. If threads, which implementation and why? How can you maintain the time remaining per reservation number within the threads? (I said TTL)

I didn't have enough time left to finish implementing the second one and interviewer told me they would not be moving forward at the end of the interview (lol, but appreciated the transparency).

Comments (13)