Google | L4 | Phone Screening | April 2025
Summary
I had a phone screening at Google for an L4 role in April 2025 where I was asked to design an algorithm for managing birthday reminders in a family tree.
Full Experience
Question:
Design an algorithm to manage birthday reminders for your family tree. You are given a genealogical tree representing your direct ancestors, rooted at you. Each person in the tree has a name and birthday. Your task is to implement a function alarmNextBirthday() that sets an alarm for the next upcoming birthday in the family tree. After that birthday passes, alarmNextBirthday() should be called again to set an alarm for the subsequent upcoming birthday, and so on.
Approach:
- Maintain a Min Heap where the priority is the number of days left until their next birthday, based on today's date
- Build a deque from it to preserve the birthday order.
- alarmNextBirthday() a. Pop the front of the deque → that's the next birthday b. Append them to the back (so it recycles to next year) c. Return the person
Interview Questions (1)
Design an algorithm to manage birthday reminders for your family tree. You are given a genealogical tree representing your direct ancestors, rooted at you. Each person in the tree has a name and birthday. Your task is to implement a function alarmNextBirthday() that sets an alarm for the next upcoming birthday in the family tree. After that birthday passes, alarmNextBirthday() should be called again to set an alarm for the subsequent upcoming birthday, and so on.