Google inc interview experience Real time questions & tips from candidates to crack your interview

SWE Intern

Google inc
upvote
share-icon
3 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Journey
I applied on the portal and was shortlisted. I had three rounds of interviews, but I was disqualified after the third round. I was asked questions about arrays, trees, and multisets in the three rounds, and I was unable to solve the multiset question.
Application story
I applied on the portal with my resume and received an invite from a recruiter at Google. She asked me about my coding platform profiles and inquired about the number of questions I had solved. Then she scheduled the first round of interviews. I appeared for it, and after a week, my second round was scheduled. Following that, my third round was scheduled 2-3 weeks later.
Why selected/rejected for the role?
I was not selected due to a lack of understanding of time complexity and some conceptual gaps. In the third round, I proposed a solution using a data structure I knew existed in Python but was not aware of its time complexities. The interviewer, being from a C++ background, suggested an equivalent in C++, which I was unaware of.
Preparation
Duration: 1 month
Topics: Data Structures, Algorithms, Arrays, Strings, Trees, Dynamic Programming
Tip
Tip

Tip 1: Focus on time complexities.
Tip 2: Spend 20 minutes on each question: 7-8 minutes ideating, 4-5 minutes coding, and the rest discussing time and space complexities.
Tip 3: Practice writing code on a Google Doc, as you won’t have access to an IDE during the interview.
Tip 4: Write clean code with good variable names so that a non-coder can also understand what your function does.

Application process
Where: Company Website
Eligibility: N/A, (Salary Package - 18 LPA)
Resume Tip
Resume tip

Tip 1: Highlight only authentic projects.
Tip 2: Mention your coding profiles.

Interview rounds

01
Round
Easy
Video Call
Duration60 minutes
Interview date24 Aug 2023
Coding problem1

Timing: Afternoon.
Comfortable Environment.

1. Maximum In Sliding Windows Of Size K

Moderate
20m average time
80% success
0/80
Asked in companies
AppleWalmartOYO

Given an array/list of integers of length ‘N’, there is a sliding window of size ‘K’ which moves from the beginning of the array, to the very end. You can only see the ‘K’ numbers in a particular window at a time. For each of the 'N'-'K'+1 different windows thus formed, you are supposed to return the maximum element in each of them, from the given array/list.

Problem approach

I used a SortedList in Python:
from sortedcontainers import SortedList
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
output = []
window = SortedList(nums[: k])
for i in range(k, len(nums)):
output.append(window[-1])
window.add(nums[i])
window.remove(nums[i - k])
output.append(window[-1])
return output

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date18 Sep 2023
Coding problem1

Timing: Afternoon.
Comfortable Environment.

1. Good Nodes

Easy
15m average time
80% success
0/40
Asked in companies
MicrosoftOracleMorgan Stanley

You are given the root node of a binary tree consisting of ‘N’ nodes. Your task is to find the number of good nodes in the given binary tree.

A good node is defined as good if there are no nodes with a value greater than X’s value in the path from the root to X.

You are given a root node ‘ROOT’.Your task is to return the number of good nodes.

Example:
Elements are in the level order form. The input consists of values of nodes separated by a single space in a single line. In case a node is null, we take -1 in its place.

For example, the input for the tree depicted in the below image would be :

Example

1
2 3
4 -1 5 6
-1 7 -1 -1 -1 -1
-1 -1

Explanation :
Level 1 :
The root node of the tree is 1

Level 2 :
Left child of 1 = 2
Right child of 1 = 3

Level 3 :
Left child of 2 = 4
Right child of 2 = null (-1)
Left child of 3 = 5
Right child of 3 = 6

Level 4 :
Left child of 4 = null (-1)
Right child of 4 = 7
Left child of 5 = null (-1)
Right child of 5 = null (-1)
Left child of 6 = null (-1)
Right child of 6 = null (-1)

Level 5 :
Left child of 7 = null (-1)
Right child of 7 = null (-1)

The first not-null node (of the previous level) is treated as the parent of the first two nodes of the current level. 

The second not-null node (of the previous level) is treated as the parent node for the next two nodes of the current level and so on.

The input ends when all nodes at the last level are null (-1).
Note :
The above format was just to provide clarity on how the input is formed for a given tree. 

The sequence will be put together in a single line separated by a single space. Hence, for the above-depicted tree, the input will be given as:

1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1
Problem approach

I stored a frequency map and used DFS to traverse the array. Then stored the sum of its children for each node. While coming back, I compared the node with the sum of its children and incremented the count accordingly.

Try solving now
03
Round
Easy
Video Call
Duration60 minutes
Interview date20 Oct 2023
Coding problem1

Timing: Evening
Comfortable Environment.

1. Maximum Of All Subarrays Of Size k.

Moderate
20m average time
80% success
0/80
Asked in companies
AmazonOracleSAP Labs

You are given an array consisting of N non-negative integers, and an integer K denoting the length of a subarray, your task is to determine the maximum elements for each subarray of size K.

Note:
A subarray is a contiguous subset of an array.

The array may contain duplicate elements.

The given array follows 0-based indexing.

It is guaranteed that there exists at least one subarray of size K.
Problem approach

I approached the problem with a brute-force solution first and then moved on to a solution using SortedList in Python. SortedList is a list that stores elements in sorted order, with insertion and deletion operations having a time complexity of O(log N). The solution was optimal according to Python, but I was unaware of the actual time complexities and incorrectly stated that the insertion and deletion complexities were O(N), which is similar to an array. This made the overall time complexity of my solution O(N²). The interviewer was unfamiliar with SortedList, so they thought it was a suboptimal solution.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SWE Intern
3 rounds | 4 problems
Interviewed by Google inc
1150 views
0 comments
0 upvotes
company logo
SWE Intern
1 rounds | 2 problems
Interviewed by Google inc
1123 views
0 comments
0 upvotes
company logo
L3 Engineer
3 rounds | 4 problems
Interviewed by Google inc
1706 views
0 comments
0 upvotes
company logo
SWE Intern
3 rounds | 4 problems
Interviewed by Google inc
1532 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SWE Intern
4 rounds | 6 problems
Interviewed by Microsoft
2320 views
0 comments
0 upvotes
company logo
SWE Intern
4 rounds | 6 problems
Interviewed by Dunzo
871 views
0 comments
0 upvotes
company logo
SWE Intern
4 rounds | 5 problems
Interviewed by Microsoft
0 views
0 comments
0 upvotes