Google | L4 | Phone Screening | April 2025

google logo
google
SDE II
April 22, 20255 reads

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:

  1. Maintain a Min Heap where the priority is the number of days left until their next birthday, based on today's date
  2. Build a deque from it to preserve the birthday order.
  3. 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)

Q1
Design Birthday Reminders for Family Tree
Data Structures & Algorithms

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.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!