Google Phone Screening for L4
Summary
I had a phone screening interview with Google for an L4 position. The round included a code output analysis question and a DSA question involving forming a target word from dictionary prefixes and suffixes. I was selected for onsite interviews.
Full Experience
1st Round - Phone Screening
After initial introductions
The interviewer gave me a piece of code and told me to write the expected output from that code.
It was a simple code comparing characters from two strings and if the characters were not matching , it was returning the index.
He then asked me to name the function which I did.
This was followed with a DSA question
Given a dictionary of words and a target word , return true if the target word can be formed from prefix and suffix of words in dictionary.
eg : dictionary : {"frog", "hat"}
targetWord -> frot, return true since fro from word 1(which is prefix) and t from word 2(which is suffix) satisfy the cndition.
I told the brute force approach in which we can check every string and if some prefix matches , we then go on to match suffix
He asked me the TC and SC of this solution and after that asked , what other approaches I can think of.
I suggested a 2nd Approach with Trie DS, we could store every word of dictionary in Trie and can then check for the targetWord.
We would need to create 2 trie's , 1st prefixTree and 2nd as suffixTree.
He asked me the TC and SC of this approach and asked when would you go for the first approach and when for 2nd.
My answer was for this particular question we can go ahead with the 1st approach but if we have stream of target words we can then move ahead with the Trie approach since it would only take O(targetWordLength) to match that word in Trie.
He was satisfied with the answer and told me to code the 1st approach.
I did code it but I think it had some bugs which he pointed out in the feedback but overall the round was positive and I was seleced for onsite interviews.
Interview Questions (2)
The interviewer provided a piece of code that compared characters from two strings. If characters did not match, it returned the index. I was asked to determine the expected output and name the function.
Given a dictionary of words and a target word, return true if the target word can be formed from a prefix of one word and a suffix of another word (possibly the same word) in the dictionary.
Example: dictionary: {"frog", "hat"}
targetWord: "frot" -> true (fro from 'frog', t from 'hat').