Google L3 | Phone Screening | Interview
Summary
I recently had a phone screening interview for an L3 role at Google, where I was presented with two challenging string manipulation problems, both of which I successfully solved.
Full Experience
I recently underwent a phone screening interview for an L3 position at Google. The interview focused heavily on my problem-solving skills, and I was given two distinct coding challenges related to string encoding and decoding. I managed to solve both problems during the interview session, feeling confident in my approaches.
Interview Questions (2)
Encode String with Brackets
Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. You may assume that the input string is always valid; No extra white spaces, square brackets are well-formed, etc.
Input: s = "3[a]2[bc]"
Output: "aaabcbc"
Decode String to Shortest Encoded Form
Given a decoded string, find the shortest possible encoded string. The encoding rule is: k[encoded_string], where k is the number of times encoded_string repeats. The goal is to minimize the length of the encoded string.
Input: s = "aaabcbc"
Output: "3[a]2[bc]"