Panda Guru LogoPanda
Guru

Google Telephone Screening round

Round 1

Questions: The interviewer asked a problem similar to decoding an encoded string, for example:

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

The expected output for the encoded string is:

abddbdde

Additionally, the interviewer asked to reverse the process, i.e., given the string abddbdde, return the encoded string.

Candidate's Approach

The candidate solved the decoding problem using a stack within 25 minutes. They correctly identified the space complexity but initially miscalculated the time complexity as O(n), where n is the length of the decompressed string. The interviewer pointed out that the correct time complexity should be O(n * k), where k is the maximum repeat count given inside the braces. The candidate acknowledged this and mentioned that the code would work optimally if strings were stored directly instead of characters.

For the encoding part, the candidate explained the approach using recursion and backtracking, demonstrating how to derive the encoded string from the given input.

Interviewer's Feedback

The interviewer was satisfied with the candidate's approach to both the decoding and encoding problems. They noted that the code was perfect and did not require optimization for the decoding process. The candidate's explanations and thought processes regarding negative test cases and input validation were also positively received.