If you are an engineer or would-be engineer looking to snap up a position at Google, you may want to take some time to study the most common Google interview questions. In this post, we will visit some of the most common questions they ask during phone screens, and further down the line for junior and senior engineering roles.

Want interview questions in your inbox? Stay sharp!

Subscribe

Get CrunchSkills in your inbox weekly. Stay sharp for your next technical interview.

#1 Top Google interview question:

Given an arbitrary string of character eg. ‘aabcdef’;
Return the first recurring character.

This question is frequently asked during phone screens, more often than any other question. Surprisingly most fail this simply by providing inefficient implementations. We wrote at length about this particular question in a recent post, Most common phone interview question at google.

The correct solution should be O(n) linear time, like such:

Create a hashmap of seen characters

For all characters in string
	If character is already in the hashtable 
		Return character // Solution found!
	Else 
		Add character to hashtable // First occurence of a character found

#2 Most frequently asked on-site question

Given a list of integers, find the smallest consecutive set of integers that sums up to a given number k

This question was answered fantastically by our friends at GeeksforGeeks with six different language examples. Check out the others here.

Here is their best python solution contributed by shreyanshi_arun

# Returns true if the 
# there is a subarray 
# of arr[] with sum 
# equal to 'sum' 
# otherwise returns 
# false. Also, prints 
# the result 
def subArraySum(arr, n, sum): 
	
	# Pick a starting 
	# point 
	for i in range(n): 
		curr_sum = arr[i] 
	
		# try all subarrays 
		# starting with 'i' 
		j = i+1
		while j <= n: 
		
			if curr_sum == sum: 
				print ("Sum found between") 
				print("indexes %d and %d"%( i, j-1)) 
				
				return 1
				
			if curr_sum > sum or j == n: 
				break
			
			curr_sum = curr_sum + arr[j] 
			j += 1

	print ("No subarray found") 
	return 0

# Driver program 
arr = [15, 2, 4, 8, 9, 5, 10, 23] 
n = len(arr) 
sum = 23

subArraySum(arr, n, sum) 

# This code is Contributed by shreyanshi_arun. 
Credit for this solution goes to shreyanshi_arun and geeksforgeeks.org
  • Output: Sum found between indexes 1 and 4
  • Complexity Analysis:
  • Time Complexity: O(n^2) in worst case.
    Nested loop is used to traverse the array so the time complexity is O(n^2)
  • Space Complexity: O(1).
    As constant extra space is required.

#3 Second-most common on-site Google interview question

Given a pair of identical binary trees (A and B), return a reference in tree B to a node N in tree A without modifying either tree.

This question comes in a few variations but always has the same type of solution. The process involves simply performing a BFS (Breadth-first search) of the second tree, B, and comparing each node to the target N. Once a match is found, simply return it. This question is unusually straight-forward for a Google interview, because this is a communications-focused question. The interviewer wants to see if, when given a trivial problem, can a candidate still clearly explain a thought process that is near automatic?

#4 Top Google Interview Question for Cloud Solutions Engineers

Imagine working with one of our enterprise clients. They are concerned about moving their servers to cloud. How would you approach the situation?

This question is a bit different because there is no single correct answer. For this question, and questions like it, it is best to rely on giving an original answer that helps demonstrate how you exemplify Google's core values. You also want to demonstrate a deep understanding of Google's own cloud products in Google Cloud Platform (GCP)

In his book "How Google Works", former CEO Eric Schmidt writes that Google's core values are as such:

  1. Focus on the user and all else will follow.
  2. It’s best to do one thing really, really well.
  3. Fast is better than slow.
  4. Democracy on the web works.
  5. You don’t need to be at your desk to need an answer.
  6. You can make money without doing evil.
  7. There’s always more information out there.
  8. The need for information crosses all borders.
  9. You can be serious without a suit.
  10. Great just isn’t good enough.

Note: Amazon's 14 leadership principles include a very similar top value

"Customer Obsession
Leaders start with the customer and work backwards. They work vigorously to earn and keep customer trust. Although leaders pay attention to competitors, they obsess over customers."

#5 Top Google Interview Question (All Roles)

Why do you want to work at Google?

I know what you're thinking, this one sounds like a no-brainer. But, you would be surprised by the number of candidates who give an underwhelming, poorly thought out answer to this question. These candidates ruin their entire application by not thinking of this one ahead of time! Let's review a few "bad answers" in order to understand what a good answer might be for you.

"I want to work at Google because I use Google every day"

This seems like a good answer, but it's not because it says nothing about your strengths.

"I want to work at Google because I get to work on difficult problems, and challenge myself"

Again, this may sound good on the surface, and it's not as bad as the first answer, however this answer could still be better. Let me explain how with a simple 3-step process.

First: Say something positive about Google that is uncommon or makes you stand out. An example of this may be:

"I want to work at Google, first of all, because I have a lot of respect for the speed with which they have gained ground against Amazon with the Google Cloud Platform."

This alone is not a good answer, but it's a good practice to start with something like this because it puts a positive thought in to the interviewers head, while demonstrating your depth of knowledge about the company at the same time.

Next, we want to tell them what's in it for you. This part of your answer is the middle of the "feelgood sandwich" we're creating with our answer. In the middle we introduce the very honest reason you want to work there. You can be somewhat selfish here and possibly even negative. Why? Because your goal is to create trust with your interviewer. As an example:

"As someone who has spent a lot of time researching my options, I tend to think Google is the company where I can pursue my professional interests in machine learning most effectively, due to Google's massive amounts of customer data."

Finally, we want to tell the interviewer about our own strengths, and tell them coming from a position of helping the company:

"I also think my ability to write clearly and concisely about both computer science and behavioral interviews is exactly what Google needs in order to grow over the next 5 to 10 years"

That's it! Those are five of the top Google interview questions you may run in to for software development related roles. Did we miss one? Let us know and we'll add it to a follow-up post.

Want interview questions and tips in your inbox?

Subscribe

Get CrunchSkills in your inbox weekly. Stay sharp for your next technical interview.
CrunchSkills is on Slack!

We also just launched a free Slack channel to chat about programming, computer science questions, and interview prep. Join us on Slack!