Amazon SDE Intern Phone final round
Anonymous User
2024

10 minute LPs

30 minute design question: Design an alarm clock

  • Alarm clock should be able to add, delete, and toggle on/off alarms
  • Alarm clock will ring at the correct time
  • Should be able to distinguish alarms and reminders
  • You will not write working code for this question. Just some language syntax and stubbed methods with comment description is fine.

My approach was as follows:
Make a C++ alarm clock class and an event super class with alarm and reminder sub classes
The C++ alarm clock class will instantiate and own a timer thread and an interface thread.
Will also have a hashmap of string, vector<event> .
The interface thread owns the standard input and waits for commands to come in, such as add, delete, toggle.
The timer thread polls at the start of every minute whether the current time is in the hashmap and then signals all of the alarms/reminders
associated with that time
My design allows minute granularity.

I had some extra logic/data structures for enabling the toggling feature.

Could someone let me know if I got to a reasonable answer or not? I don't even know if they were intending for me to use multithreading.

5 minute thought question:

  • What is the difference between tech stack, tech queue, and tech minheap. Please list the unique benefits of each. I didn't know how to answer this one.
Comments (5)