Google L4 In-person Interview
Anonymous User
3856

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 ?

Comments (4)