google logo
Google· SDE II

Google L4 1st Onsite round

Posted
25 Apr 2025
350 reads

Summary

I had my first onsite round with Google for an L4 position. I was asked to build a program for string substitution with variable references, including a follow-up on cyclic references, which I mostly solved recursively.

How it went

So just few minutes back I had my first onsite round with Google for L4 position(SWE-3), The interviewer was so cooperative and humble guy from Europe. Asked me to built a program to substitute a string with given variables: #{'X':'%Z%', 'Y':'45', 'Z':'32'} #string='%X%_%Y%' #output: 32_45 earlier he didn't mentioned about variables can refer to other variables too, but later he followed up with that on which I tweaked my solution to a recursive approach. Good experience over all.

Questions asked (1)

  1. 01

    String Substitution with Variable References and Cycle Detection

    Data Structures & Algorithms · Hard

    Build a program to substitute a string with given variables. The variables are provided in a dictionary-like structure, and the string contains placeholders enclosed in '%' characters.

    Initial problem example:
    data = {'X':'%Z%', 'Y':'45', 'Z':'32'}
    string_to_resolve = '%X%_%Y%'
    Expected output: '32_45'

    Follow-up: Variables can refer to other variables (e.g., 'X' might refer to 'Z'), requiring a recursive approach. Also, consider cycle detection to handle cases where variables refer to each other in a loop.

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!