Posts How to Prepare for Google Interview
Post
Cancel

How to Prepare for Google Interview

Disclaimer: The below writeup is based on my readings and experience and do not in any way reflect the opinions of my past or present employer[s]

I recently joined Google as a Software Engineer. Ever since I shared the news on LinkedIn, I have been getting queries on how to prepare and how to face the interview.
I have been trying to answer those questions, but its not easy to answer everyone. Sometimes, I miss to answer any follow up questions.
So, I thought, I will write down, so that I can do justice to all.
Here are a few queries I get asked a lot.
Please note: I don’t have answers to all the questions. So, please bare with me.

What do I prepare?

At companies like Google, they give atmost importance to Data Structures and Algorithms. They don’t really care about the technology you are coming from.

For example, I have been into the .Net world writing C# code for a decade. But, I am hired to work on Go and python.
They did not ask me any questions on how things work in C# or even Go or python during the interview process.
I was given the option to opt any language to attend the interview in. I chose C# to write the algorithms. This was not an issue at all, although myself and the interviewer was certain that I would not get C# as my language of choice if and once I am hired to Google.

This strategy is common across a lot of companies like Amazon, Microsoft, Uber, etc.
So, if you are afraid that you don’t know the programming language already used at Google, don’t worry. You are not alone.

How do I prepare?

You have a lot of options to prepare on Data Structures and Algorithms. And yes, it gets better over time.
I started seriously preparing DSAlgo while preparing to interview for Microsoft. This was long back. Looking back, I can certainly say that it helped.

Things that worked for me.

1. The book Data Structures and Algorithms Made Easy by Narasimha Karumanchi.

This is a good book for beginners. It sets the basics for dsalgo.
It helped me to start think differently. Once I went through a bunch of examples, I started thinking for ways to optimize a solution.
Please note: This does not completely train you for attending an interview, but it gives a good start.
You can buy it from Amazon here.

2. Practicing on LeetCode.

Its easily said than done.
From the time I started preparing for Microsoft, I tried prepping on multiple platform only to completely fail and lose hope and give up. I would eventually go back to reading solutions on GeekForGeeks.
It helps, but this is not enough. You have to write code and only then would you be able to pick up on your dsalgo skills.

The trick is, to try the easy solutions first.

If you are new to any competitive coding platform, then it is going to be very difficult to tackle this one. We also tend to go for the Medium or Hard problems right at the beginning. Don’t fall for that. You will most probably end up giving up.
You should try the Easy problems first. And even over here you might end up confused on the solution.
That’s OK. Again you are not alone.
Just copy the problem title, jump over to Youtube, and search for the problem.
Keep doing this and you will slowly start getting better.
Eventually you can get to the medium problems.
Its ok to skip the hard problems. They are too complicated, many a times its even difficult to understand solutions given on youtube.

3. My Write-Up

I also wrote down some Data Structure and Algorithms solutions as I was trying out Leetcode.
You can find it here: https://dsalgo.ajalex.com/
I hope this helps.

4. Other Platforms

I don’t have an extensive list, but here is a few:

These are just a few that I found helpful.

What all Data Structures should I prepare?

I don’t have an exact answer to this. I think the questions asked to you dependes on the interviewer.
Simple answer, try to cover all the basic ones.

  • Array
  • Stack
  • Queue
  • Tree
  • Linked List
  • Priority Queue
  • Graph
    • BFS and DFS atleast
  • Dynamic Programming

You may get questions from any of these. It all depends on the person interviewing.
In my experience, nobody asked my a direct dsalgo question, like: “I have a tree, I need to do this or that”. All the questions were scenario based.
The interviewer would give a scenario and I would have to come up with a data structure and solution.

The above points apply to many companies, the likes of Microsoft, Amazon, Uber, LinkedIn, etc.

Google specific Interview tips

Interviews at Google are mostly 45 minutes (atleast the ones that I had and I have heard of).
You have to try and complete the entire interview in 45 minutes.

They rate you based on the following (again based on my understanding):

  1. Your coding skills (of course)
  2. Data Structure
    How correctly do you choose your data structure.
    Its better to call out the data structure you are going to use for your solution, so that the interviewer gets to knows what DS have you selected, and he/she gets the confidence that you know what you are doing.
  3. Communication
    As in all the interviews, communication matters.
    • Convey the thought you have for your solution.
    • Think out loud, so that the interviewer can follow you, correct you (if you are mistaken) or redirect you (in case you are going in the wrong direction).
      Again, its ok to go in the wrong direction and be mistaken, as long as you get back in line.
    • Call out your assumptions about the problem.
      Don’t assume. Ask if it is ok to assume something.
    • Ask Questions. As much as you feel.
      In fact, in one of my rounds, the question itself was kind of incomplete. It was expected of me to ask the right questions and then figure out the entire question.
      You may be rated on if you did or did not ask the questions.
      For example, if I have to split a sentence into words, don’t assume that you will have to split the string based on SPACE. You could split based on a comma, colon, etc. Raise your voice. Ask. Confirm.
  4. Time taken
    • How well do you utilize the time.
      Like I mentioned earlier, the interview is 45 minutes long. Try to cap it within the timeframe.
      Even if you spill out of 45 minutes, the interviewer would most probably not stop the interview then and there. But it might count. I mean, it depends. Sometimes, it might be ok to spill over 5 or 10 minutes (I hope).
      Try to wrap up the original problem in 30 - 35 minutes, so that there is ample time for a follow up question which might go for another 10 minutes.

During my rounds, I tried to wrap up my personal introduction in max 2 minutes, so that I have ample time for coding.
I didn’t feel like my personal introduction made any difference.
So, my advice. Don’t spend too much time on it.

  1. Your solution
    Its not just the output that matters.
    How well you achieved also counts.
    • Bounday Conditions
      Did you consider all the boundary conditions?
      How well did you iron out the possibility of any bugs?
    • Other design aspects that might cover based on the question asked.

These are a few things that are important at a Google interview. Again, the above doesn’t necessarily reflect the exact criterias considered by Google. These are based on my readings and feedbacks I received.

Did you not get it right!

99.99% of people who go for an interview do not have a perfect trip.
You might give a wrong solution.
You might get the data structure wrong.
You might get the logic wrong.
You might go in an entirely wrong direction, but manage to get the right answer.
Sometimes, you might give a different idea for a solution which is not necessarily optimal, but unique which the interviewer might actually like or dislike.
You might get stuck at the thought of “Did I do it right!” or “I should rather have done it this way than that way”.
You might even screw up an entire round.

You are not alone.
This happens to almost everyone.
None of this guarantees that you are out.
You might still get through. Keep your hopes up and pray to God (if you believe in God).

Failure

We all fear the interviews because we fear we might be rejected.

When I went for the interview at Oracle, my Father told me this dialogue.


Don’t you worry. What do you have to lose? Nothing.
At worst, you might not get through.
So what? You still have the right to life.
Well, you still have your current job as well.
You have nothing to lose.
Go, do your best

Think about it. You don’t have anything to lose.
You only gain. The experience.
If you fail now, go back, prep again, try again.
If you fail again, go back, prep again, try again.
Repeat.

Trust me. I am speaking from my experience.
I have failed a Quadrillion times.

I know the feeling. Its difficult. But, I also know that it will pass.
You never sit and cry over a failed interview throughout your life.
You shouldn’t. Its not worth it.

Just have one thing.

Perseverance.
Don’t give up
You can win.

Enjoy your life.

This post is licensed under CC BY 4.0 by the author.