google logo
Google· SDE II

Google L4 In-person Interview

Location
BLR
Posted
14 May 2026
185 reads

Summary

I had an in‑person L4 interview at Google in Bangalore where I was given a mapping question involving placeholder keys and recursive resolution.

How it went

Location : BLR Role : L4

I gave my Google in‑person interview today. I wanted to know as per the mistakes what kind of rating [ ie NH/LH/H ] I could get according to you guys.

It was a mapping question where provided a key‑value pair and source string, I was supposed to return the output. In the source string anything that was present between 2 % signs were supposed to be taken as a key.

My mistakes :

  1. I pointed out all keys might not be present so we will return "-1" as response. The interview said that could also be a valid response. I took a couple of secs to think and till the interviewer said "How about returning an error ?" I went with his idea and implemented that.
  2. I totally missed that a key's value could have another key present inside it. Eg : X--> "%y%/home". I simply needed to add a recursive call after finding the key and I did that.
  3. After doing the recursive call, I told him that we might have cycles. I stored earlier occuring keys in a vector and he suggested why not use a unordered_map to save time and space.

What do you guys think ?

Questions asked (1)

  1. 01

    String Placeholder Mapping Replacement

    Data Structures & Algorithms · Medium

    Given a dictionary of key‑value pairs and a source string, replace every placeholder in the source string with its corresponding value. A placeholder is defined as any substring that appears between two % characters (e.g., %key%). The replacement must handle nested placeholders, i.e., a value may itself contain other placeholders that need to be resolved recursively. If a placeholder refers to a key that does not exist, the solution should return an error (or "-1"). The algorithm must also detect cycles (e.g., %a% refers to %b% and %b% refers back to %a%) and handle them gracefully, preferably using a hash map for visited keys to avoid infinite recursion.

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!