Google Telephone Screening round

Anonymous User
1220
Feb 16, 2025
Feb 16, 2025

Recently I had my Google telephone screening round.
I was asked problem similar to decode the encoded string for example

a(b(d){2}){2}e so this the encoded string output should be.
a(bdd){2}e
abddbdde

I did solve it using stack. I was able to code this within 25 minutes. interviewer was satisfied I correctly told space complexity, but for time complexity, I was storing the characters onto the stack, I already had told we can store strings instead of chars but interviewer told to start with chars. So for that when asked of time complexity I told O(n) n - length of decompressed string, but it was not fully correct it was somewhere around O(n * k) k - maximum repeat count given inside {}. I then agreed with him and told we can optimise to O(n) he said no need for that, actually code is perfect and will work if we store the strings directly.

Then we spent some time thinking on negative test cases and adding validation for input to be in specific format.

He then asked me to do reverse i.e if we have given a string abddbdde it should return encoded string. He just wanted to check my approach. I did tell me him how can we do that using recursion and backtracking like

abddbdde
ab(d){2}b(d){2}e
a(b(d){2}){2}e

He was satisfied with my approach.

What are my chances of getting shortlisted for onsite rounds?

Comments (7)