Google phone screen
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-01-23Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
I had a phone screen today for L4 level role and here was the question that was asked
Given an input file which is too large to fit entirely in memory and some banned words in another smaller file also we have been given an empty output file , our task is to replace all banned words with "Banned" and write the entire input file to output file
Given:
1. Lenght of each word in banned words file is <=15
2. There is no space in banned words and exact match we need to do only
3. We have given already implemented methods like next() , close(), write() for file
My approch: I suggested Trie approch here to add all the banned words to trie and check line by line in file to replace banned words with banned
He agreed and stated that let us assume that Methods of Trie class are also given implemented like has(word) -> true, false
His main aim was to focus on how to read file in chunks, replace the word as we cannot go back in file once read and proper space usage and syntax
Not if this was a DSA or implementation round as main data structure was already implemented
<nSolved the above question with 2-3 edge cases missing and didnt had time to code that up but explained how to fix them
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
I had a phone screen today for L4 level role and here was the question that was asked
Given an input file which is too large to fit entirely in memory and some banned words in another smaller file also we have been given an empty output file , our task is to replace all banned words with "Banned" and write the entire input file to output file
Given:
1. Lenght of each word in banned words file is <=15
2. There is no space in banned words and exact match we need to do only
3. We have given already implemented methods like next() , close(), write() for file
My approch: I suggested Trie approch here to add all the banned words to trie and check line by line in file to replace banned words with banned
He agreed and stated that let us assume that Methods of Trie class are also given implemented like has(word) -> true, false
His main aim was to focus on how to read file in chunks, replace the word as we cannot go back in file once read and proper space usage and syntax
Not if this was a DSA or implementation round as main data structure was already implemented
<nSolved the above question with 2-3 edge cases missing and didnt had time to code that up but explained how to fix them