google logo
Google· SWE III

Google Phone Screening

Result
Offer
Location
Hyderabad
Experience
4 years
Posted
29 Mar 2026
666 reads

Summary

I participated in a phone screening interview for Google where I was presented with a challenging coding problem involving string manipulation and time calculations.

How it went

I had my phone screening interview for Google. The interviewer presented me with a problem to find the closest valid time to a given reference time, where the input time could have missing digits marked by '?'.

I began by discussing my approach, which centered around a recursive backtracking method to explore all possible digit combinations for the question marks. I also explained the necessity of helper functions to validate a generated time and to calculate the difference between two times, considering the wrap-around nature of a 24-hour clock. I then proceeded to implement these functions and the main recursive logic, ensuring to handle the time constraints (00:00 to 23:59) and correctly comparing time differences.

Questions asked (1)

  1. 01

    Closest Time with Missing Digits

    Data Structures & Algorithms · Medium

    Given two times (in 24-hour format), one with missing digits marked as '?', and the other with no missing digits, we want to replace all of the question marks in the first time by digits (0-9) in such a way as to obtain the time closest to the second time. The earliest possible time is 00:00 and the latest valid time is 23:59. A time X is closer to Y than Z if the difference between X and Y is smaller than the difference between Y and Z.

    Examples:
    1. Given givenTime = "2?:?82", and referenceTime = "23:57" the function should return "23:58".
    2. Given givenTime = "?8:4?" and referenceTime = "09:00", the function should return "08:49".
    3. Given givenTime = "??:??" and referenceTime = "12:00", the function should return "12:00".
    4. Given givenTime = "06:34" and referenceTime = "12:00", the function should return "06:34".

How they prepared

Striver's

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Google recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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