Google | Rejected | L4

Anonymous User
1417
Mar 21, 2025

Current Company : Siemens Healthineers (When I got call)
Experience : 3.5+ yrs
College : Tier-1

I received a call from a recruiter in December 2024, who informed me to wait until the end of January 2025 due to cool off period since I had also appeared for an interview back in 2024. This worked well for me, as I wanted additional time to prepare.

In early February, the preliminary round was scheduled; however, due to various conflicts and delays, it was rescheduled three to four times. Eventually, it took place on the few days back.


Problem

To design a Bigram Frequency Predictor, the model utilizes training data as input. When a user enters a word, the predictor should return the word that most frequently follows the given word in the training data.

[
    [ "I" , "like", "dog"], //this is a single sentence
    [ "I" , "like", "Mango"],
    [ "Mango", "I", "sweet"]
]
// Given word: "I" 
// Predicted word : "like" 
// For "Dog" it should be empty string as nothing is there after that.

Approach

I used the Hashmap approach to train and predict the word.

unordered_map<string,unordered_map<string,int>> wordsFreq;

Later on he asked to optimize the space. as time was limited I have suggested to use Trie DS, which can efficiently store words.

Closed the interview with few Q&A session about Google search.

Feedback:

  1. Speed was slow (Not able to relate as solved within 20-25 minutes)
  2. The data structure I used is good but I could have used something more better. (Still not able to figure out)

My POV:

I came up with an approach and implemented a fully coded solution within 20 minutes. I believe I answered the question correctly, as I later talked to a few people working at Google and Microsoft, and they also arrived at the same approach. I am not able to understand

Please feel free to comment what could be other approaches that would be efficient and scalable. Also please comment if you have got the same question and cleared the round.

Comments (11)