How I Prepared for the Google Internship Interview.
Tags: programming, algorithms, computerscience, googlecloud
Published: 2021-04-26 03:32:08

Hey everyone, I'm Atibhi, I interned with Google as a Summer Intern in 2020. After I got the internship, a lot of people asked me about my preparation strategy.

In this blog post, I have tried to clear some of the common questions every student has regarding interview preparation. I have also included resources that helped me during my preparation!


### My site of choice - Leetcode

I have explored many sites and in the end, I found Leetcode to be the best.
Sites like CodeChef, Codeforces, SPOJ are really good but they are not interview/job-focused, they lean more towards competitive programming. If your aim is to go compete at ACM ICPC, by all means, practice at those sites.
For interview preparation, the top sites are Leetcode, GeeksForGeeks and Interview Bit. Leetcode beats the other two sites hands down. While the theory in GeeksForGeeks is good (it is often coded inefficiently) and their practice platform has weak test cases. InterviewBit has a good collection of questions but their list is limited, also they do not have a vibrant community.
Leetcode has everything that a good site should, an amazing list of questions, good editorials, really good test cases as well as a community(best thing). The discussion section has amazing discussions, sometimes the solutions here are better than those in the editorial.

### I Am Intimidated by the List of Questions, Where Should I Start?

First and foremost, there is no reason to be intimidated, we all have to start somewhere :) If you are a complete beginner, start with Top 100 Liked Questions and Top Interview Questions. Sort them by difficulty level and do the easy ones, followed by medium and then hard.

### How Should I Solve Each Question?

Everyone has a different way of approaching problems, I initially looked up the solution to every problem but when I gave the Weekly Contests(another amazing feature! more about it later) I realized my technique wasn't working. I then thought about a question and worked out a basic algorithm and then coded. If it took more than a certain amount of time, I saw the solution. I also went through Leetcode discuss to see different approaches.
Here is a curated list of "how to Leetcode" from various people, do give it a read! It is helpful :

- [Leetcode Grinding Guide on Reddit](https://medium.com/r/?url=https%3A%2F%2Fwww.reddit.com%2Fr%2Fcscareerquestions%2Fcomments%2F6luszf%2Fa_leetcode_grinding_guide%2F)
- [Patterns on Leetcode Problems](https://medium.com/@sourabreddy)
- [Want to crack Leetcode problems easily?](https://medium.com/algorithms-and-leetcode/want-to-crack-leetcode-problems-easily-dc825e27e423)
- [r/cscareerquestions - I have to literally look up up every Leetcode solution. Is it normal?](https://medium.com/r/?url=https%3A%2F%2Fwww.reddit.com%2Fr%2Fcscareerquestions%2Fcomments%2Fbc85gv%2Fi_have_to_literally_lookup_up_every_leetcode%2F%3Futm_medium%3Dandroid_app%26utm_source%3Dshare%5D%28https%3A%2F%2Fwww.reddit.com%2Fr%2Fcscareerquestions%2Fcomments%2Fbc85gv%2Fi_have_to_literally_lookup_up_every_leetcode%2F%3Futm_medium%3Dandroid_app%26utm_source%3Dshare%29)
- [how-to-leetcode-effectively](https://medium.com/r/?url=https%3A%2F%2Fleetcode.com%2Fdiscuss%2Fgeneral-discussion%2F443629%2Fhow-to-leetcode-effectively)

### How Do I Measure My Performance, I Am Solving Questions but Am I Improving?

ONE WORD - **WEEKLY CONTESTS.** Initially, when I started giving weekly contests I would not be able to solve even a single question, but with practice, I started solving two to three. It motivated me to work harder every week and manage time better. I also maintained an excel sheet where I kept track of the questions that I solved in contests.

How my contest excel sheet looked like.

![1_3f_EiTbcnQKg3ofw4RFwyw.jpeg](https://cdn.hashnode.com/res/hashnode/image/upload/v1619156276988/htWnZq5Pi.jpeg)

### How "MANY" Questions Should I Solve?

It is not about the number of questions rather it is about "how" well you understand the concepts and are able to approach new problems. In spite of that, doing the Top Interview Questions should be a must.

### Other Tips

- Read as many interview experiences of people as you can from Leetcode Discuss.
- Ask doubts in Leetcode Discuss for each question.
- If your interview is nearing, take Leetcode Premium and do company-wise questions (very helpful).

### What are the important topics I should study ?

**Big O Notation**

- [Theory](http://web.mit.edu/16.070/www/lecture/big_o.pdf)
- Practice problems from Cracking the Coding Interview

**Arrays and Maths**

- Practice a lot of Questions on Arrays and Maths. Some important topics are mentioned below.
- [Circular Arrays - Typical ways to solve on Leetocode](https://leetcode.com/problems/next-greater-element-ii/discuss/98262/typical-ways-to-solve-circular-array-problems-java-solution)
- [Boyer Moore Voting Algorithm Leetcode](https://leetcode.com/problems/majority-element-ii/discuss/63520/Boyer-Moore-Majority-Vote-algorithm-and-my-elaboration) 
- [Two Sum Problem - Leetcode](https://leetcode.com/problems/two-sum/)
- [Three Sum Problem - Leetcode](https://leetcode.com/problems/3sum/)
- [Four Sum Problem - Leetcode](https://leetcode.com/problems/4sum/)
- [Buy and Stock problem - Leetcode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
- [Buy and Stock problem II - Leetcode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)
- [Buy and Stock problem III - Leetcode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/)
- [Buy and Stock problem IV - Leetcode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/)
- [Buy and Stock With Cooldown - Leetcode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/)
- Questions relating to Palindromes.
- [Longest Palindromic Subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/)
- [Finding square root of a number in logn time - Leetcode](https://leetcode.com/problems/sqrtx/)
- Subarray and Subsequence problems.

 **Binary Search**

- [Binary Search from Topcoder(MUST)](https://www.topcoder.com/community/competitive-programming/tutorials/binary-search)

**Bitwise manipulation**

- [A summary: how to use bit manipulation to solve problems easily and efficiently - LeetCode Discuss](https://leetcode.com/problems/sum-of-two-integers/discuss/84278/A-summary%3A-how-to-use-bit-manipulation-to-solve-problems-easily-and-efficiently)
- [Good website to visualize bitwise operations](http://bitwisecmd.com/)
- [https://www.geeksforgeeks.org/bits-manipulation-important-tactics/](https://www.geeksforgeeks.org/bits-manipulation-important-tactics/)


**Trees**

- [Pre-order(BOTH recursive and iterative)](https://leetcode.com/problems/binary-tree-preorder-traversal/)
- [Post-order(BOTH recursive and iterative](https://leetcode.com/problems/binary-tree-postorder-traversal/)
- [In-order(BOTH recursive and iterative](https://leetcode.com/problems/binary-tree-inorder-traversal/)
- [N-ary Tree Pre-order Traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)
- [N-ary Tree Pre-order Traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal)
- [N-ary Tree Level Order Traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal)
- [Maximum Depth of N-ary Tree    ](https://leetcode.com/problems/maximum-depth-of-n-ary-tree)
- [Serialization and deserialization of trees - Leetcode](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)
- Binary Search Tree
- [Lowest Common Ancestor - Leetcode](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)
- Morris In-order traversal by Tushar Roy (Video)
- [Threaded Binary Tree](https://algorithms.tutorialhorizon.com/introduction-to-threaded-binary-tree/)

**Recursion and Backtracking**

- [Recursion and Backtracking Tutorial](https://www.hackerearth.com/practice/basic-programming/recursion/recursion-and-backtracking/tutorial/)
- [Blog by csgator(BEST)](https://medium.com/leetcode-patterns/leetcode-pattern-3-backtracking-5d9e5a03dc26?source=---------6------------------)
- [Interview Bit Theory](https://www.interviewbit.com/courses/programming/topics/backtracking/)
- Turnpike problem
- [Word break Problem Leetcode](https://leetcode.com/problems/word-break/)
- [Word break Problem 2 Leetcode](https://leetcode.com/problems/word-break-ii/)
- [Letter combinations of a phone-number Leetcode](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)

**Graphs**

- [Representing graphs](https://www.khanacademy.org/computing/computer-science/algorithms/graph-representation/a/representing-graphs)
- [DFS, BFS Explanation by csgator(BEST)](https://medium.com/leetcode-patterns/leetcode-pattern-1-bfs-dfs-25-of-the-problems-part-1-519450a84353)
- Topological Sorting
- Prims and Kruskal
- Dijikstra
- [Dijkstra on sparse graphs - Competitive Programming Algorithms](https://cp-algorithms.com/graph/dijkstra_sparse.html)
- [Number of Islands](https://leetcode.com/problems/number-of-islands/)
- [Friend Circles](https://leetcode.com/problems/friend-circles/)
- [Decode String](https://leetcode.com/problems/decode-string/)

**Geometry**

- [Geometric Algorithms - GeeksforGeeks](https://www.geeksforgeeks.org/geometric-algorithms/)

**Hashing**

- [map vs unordered_map in C++ - GeeksforGeeks](https://www.geeksforgeeks.org/map-vs-unordered_map-c/)
- [Design HashMap](https://leetcode.com/problems/design-hashmap/)
- [Design Hashset](https://leetcode.com/problems/design-hashset/)
- [Sliding Window algorithm template to solve all the Leetcode substring search problem. - LeetCode Discuss (This is important !)](https://leetcode.com/problems/find-all-anagrams-in-a-string/discuss/92007/sliding-window-algorithm-template-to-solve-all-the-leetcode-substring-search-problem)
- [String Hashing](https://cp-algorithms.com/string/string-hashing.html)

**Linked List**

- Insertion 
- Deletion of Node
- Reverse Linked List (iterative and recursive)
- Circular Linked List
- Doubly Linked List
- Floyd's Cycle Detection Algorithm
- [Linked List Cycle - Leetcode](https://leetcode.com/problems/linked-list-cycle-ii/)
- [LRU Cache - C++ Implementation - Bhrigu Srivastava](http://bhrigu.me/blog/2017/01/22/lru-cache-c-plus-plus-implementation/)
- [Copy list with random-pointer (BEAUTIFUL QUESTION!)](https://leetcode.com/problems/copy-list-with-random-pointer/)

**Dynamic Programming**

- [TopCoder Article (VERY IMPORTANT!!! MUST)](https://www.topcoder.com/community/competitive-programming/tutorials/dynamic-programming-from-novice-to-advanced/)
- [Top 20 DP questions(Geeks for geeks) Important!](https://www.geeksforgeeks.org/top-20-dynamic-programming-interview-questions/)
- [Tushar Roy DP playlist](https://www.youtube.com/playlist?list=PLrmLmBdmIlpsHaNTPP_jHHDx_os9ItYXr)
- Do Questions from Interview Bit (Good List) :P
- [Top 50 DP questions](https://medium.com/@codingfreak/top-50-dynamic-programming-practice-problems-4208fed71aa3)
- [Difference between DP and Divide and Conquer](https://stackoverflow.com/questions/13538459/difference-between-divide-and-conquer-algo-and-dynamic-programming)

**Disjoint Set Union**

- [DSU CP-Algorithm](https://cp-algorithms.com/data_structures/disjoint_set_union.html)

**Sorting**

- Be clear with the basic algorithm and time complexity of all sorting algorithms.
- Additionally read up to count sort, bucket sort and radix sort.

**Greedy**

- [Basics of Greedy](https://www.hackerearth.com/practice/algorithms/greedy/basics-of-greedy-algorithms/tutorial/)

**System Design**

- [Leetcode System Design Posts](https://leetcode.com/discuss/interview-question/system-design?currentPage=1&orderBy=hot&query=)
- [System Design Videos (Sufficient for prep)](https://www.youtube.com/playlist?list=PLMCXHnjXnTnvo6alSjVkgxV-VH6EPyvoX)
- [System Design Resources](http://tiancao.me/blog/2016/02/system-design/)
- [How to succeed in a System Design Interview](https://blog.pramp.com/how-to-succeed-in-a-system-design-interview-27b35de0df26)

For now, these are the topics that I feel are important for an interview, obviously, this is not an exhaustive list :)

### Google Specific Interview Tips

-  Practice coding on google docs.
-  Write variable and function names that are descriptive.
-  Be honest. Do not bluff.
-  Be vocal, explain your approach while coding.
-  Give a lot of mock interviews to friends in a real environment.
-  Do a lot of leetcode.
-  Be confident!

Hope this blog post helped you! All the best! Feel free to comment if you need further guidance or DM me on [Twitter](https://twitter.com/atibhi_a). You can also reach me at atibhi.a@gmail.com :smile: