MOST COMMON Google CODING INTERVIEW QUESTIONS
Most Common Google Coding Interview Questions
If you’re a programmer or software engineer, chances are that you dream of working at a FAANG company. And of all the FAANG companies, Google must be at the top of your list. But scoring a job at Google isn’t a walk in the park. There’s a lot of competition, and Google ensures that it chooses the right candidates through a comprehensive interview process.
But no need to worry about that, because when you prepare well, you’ll be able to stand out from the crowd and secure the job. To help you ace the Google interview process, we’ve compiled a list of the most common Google interview questions. Let’s take a look at them so that you can start practicing and enhancing your coding skills.
Sum of two values
Arrays are an important part of Google interview questions (and many other companies’ interview questions as well). Arrays help you write efficient code, and Google strongly emphasizes the efficacy of its code. Moreover, Google interview questions involve manipulating or analyzing collections of data. Arrays are a fundamental data structure that allows you to store and manipulate a fixed-size sequence of elements.
To help you practice better, we have shared some array question examples.
Given an array of integers and a value, determine if there are any two integers in the array whose sum is equal to the given value.
Kth largest element in a stream
Design a class to efficiently find the Kth largest element in a stream of numbers.
Delete node with given key
Linked lists are one of the core concepts of computer science. Although linked lists are not commonly used, Google still emphasizes asking questions about linked lists in its coding interviews. The foremost reason is to assess the candidate’s grasp of core concepts and their ability to manipulate and traverse data structures.
So, if you’re aiming to find a place at Google, it might be beneficial to practice the problems mentioned below:
You are given the head of a linked list and a key. You have to delete the node that contains this given key.
Copy linked list with arbitrary pointer
You are given a linked list where the node has two pointers. The first is the regular ‘next’ pointer. The second pointer is called ‘arbitrary_pointer’ and it can point to any node in the linked list.
Your job is to write code to make a deep copy of the given linked list. Here, deep copy means that any operations on the original list (inserting, modifying and removing) should not affect the copied list.
Mirror binary trees
It is crucial to have a strong grasp of data structures and algorithms during your Google interview. And to ensure that you have a depth of knowledge and practice with it, the interviewer will ask about your understanding of different types of trees. These usually include problems about binary trees, binary search trees, AVL trees, or B trees.
Given the root node of a binary tree, swap the 'left' and 'right' children for each node.
Check if two binary trees are identical
Given the roots of two binary trees, determine if these trees are identical or not.
Strings are one of the most basic fundamentals of programming. To demonstrate your capability as a programmer and your understanding of core concepts, you’ll likely face string questions during your Google interview. These questions help the interviewer assess your problem-solving skills as a candidate. The following are some common examples of strings questions:
How will you go about printing the duplicate characters from a string?
How will you determine whether a string only consists of digits?
To be more specific, we have shared some more examples for your practice below:
Given a dictionary of words and an input string tell whether the input string can be completely segmented into dictionary words.
Find all palindrome substrings
Given a string find all non-single letter substrings that are palindromes.
Largest sum subarray
Dynamic programming is a powerful technique to break down a problem into smaller overlapping problems and code more efficiently. As we mentioned earlier, Google interview questions assess both your problem-solving capabilities and your ability to apply dynamic programming to real-world problems you might encounter while working at the company.
Given an array, find the contiguous subarray with the largest sum.
MATH AND STATS
Determine if the number is valid
As we all know, Google has a vast amount of data. So, it’s important to understand how the data can be manipulated and simplified. For that reason, candidates may be asked math and statistics questions in Google interviews. This helps Google evaluate candidates’ ability to work with data and draw meaningful insights. Some examples of Google interview questions related to Math and stats are mentioned below:
Given an input string, determine if it makes a valid number or not. For simplicity, assume that white spaces are not present in the input.
Print balanced brace combinations
Backtracking is one of the comprehensive topics that candidates often face during Google interview questions. Backtracking questions can be challenging because they require critical thinking and creativity. By including such questions in their interviews, Google can identify exceptional candidates who can handle complex problems, devise effective strategies for backtracking, and produce correct and efficient solutions.
Print all braces combinations for a given value 'N' so that they are balanced.
Minimum spanning tree
In order to ace your Google interview questions, it’s essential to review graphs and their fundamentals. Graphs are a valuable tool for solving complex algorithmic challenges. Therefore, you will often encounter them in Google interview questions. Candidates familiar with graph algorithms, such as breadth-first search (BFS), depth-first search (DFS), Dijkstra’s algorithm, and minimum spanning trees, can demonstrate their ability to optimize code and solve problems more efficiently.
Find the minimum spanning tree of a connected, undirected graph with weighted edges.
Implement a LRU cache
Least Recently Used (LRU) is a common caching strategy. It defines the policy to evict elements from the cache to make room for new elements when the cache is full, meaning it discards the least recently used items first.
SORTING AND SEARCHING
Find the high and low index
Sorting and searching algorithms are fundamental in improving the efficiency of data retrieval and manipulation. Google deals with vast amounts of data and has a solid understanding of efficient sorting and searching techniques. For that reason, candidates need to possess profound knowledge of how to optimize search algorithms, database operations, and other data-intensive tasks.
Given a sorted array of integers, return the low and high index of the given key. Return -1 if not found. The array length can be in the millions with many duplicates.
Merge overlapping intervals
You are given an array (list) of interval pairs as input where each interval has a start and end timestamp. The input array is sorted by starting timestamps. You are required to merge overlapping intervals and return output array (list).
MORE INTERVIEW PREP?
I'm a paragraph. Click here to add your own text and edit me. It's easy.
The best way to ace your Google interview questions is to practice very thoroughly. The questions mentioned above are assessments to practice your skills. However, this is not the end of it. To become a pro, keep practicing more coding-related questions, and if you need more help, you can check out the following:
We've partnered with Educative to bring you the best interview prep around. For more data structure and algorithm practice, check out the link below.