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

Software Engineer

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

Interview preparation journey

expand-icon
Journey
I took admission in Maharaja Surajmal Institute of Technology for B.Tech as I had always wanted to be a Software Developer in a big MNC. To get selected by them, I needed to be exceptional in my coding skills, and I knew this, so I started coding even before the college classes for the first year began. I practiced around 380 questions in the first two years of my graduation, and then I learned web development in the final phase of the second year.
Application story
In the second year of graduation, everyone in the college wanted to get internships, and I was one of them. I wanted to do an internship at big companies so that they could add to my resume. When Google visited our campus to hire interns, it was an excellent opportunity for me. So, I applied for the position.
Why selected/rejected for the role?
I was giving the correct explanation for my solutions in the coding round. I also built the optimal solution starting from the brute force algorithm, which also added to my points.
Preparation
Duration: 2 months
Topics: Arrays, Linked List, Binary Search, Stack, Queue, DFS, BFS, String, Recursion
Tip
Tip

Tip 1: Solve the SDE sheets, as most problems come from the sheet itself.
Tip 2: Try to solve the first of the two questions as quickly as possible, as the time limit is one hour.
Tip 3: Make sure you have projects and internships listed on your resume so that they can ask questions based on it.

Application process
Where: Campus
Eligibility: 7 and above
Resume Tip
Resume tip

Tip 1: Have some projects on your resume.
Tip 2: It helps if you have had some small internship experience in the past.

Interview rounds

01
Round
Medium
Online Coding Test
Duration70 mins
Interview date9 Dec 2021
Coding problem2

Part 1: 7 Bug Fixes
Part 2: 2 DSA Medium-Hard Questions
Part 3: Behavioral Questions (MCQ)

1. Container With Most Water

Moderate
15m average time
90% success
0/80
Asked in companies
BNY MellonAmazonSAP Labs

Given a sequence of ‘N’ space-separated non-negative integers A[1],A[2],A[3],......A[i]…...A[n]. Where each number of the sequence represents the height of the line drawn at point 'i'. Hence on the cartesian plane, each line is drawn from coordinate ('i',0) to coordinate ('i', 'A[i]'), here ‘i’ ranges from 1 to ‘N’. Find two lines, which, together with the x-axis forms a container, such that the container contains the most area of water.

Note :
1. You can not slant the container i.e. the height of the water is equal to the minimum height of the two lines which define the container.

2. Do not print anything, you just need to return the area of the container with maximum water.
Example

water-diagram

For the above Diagram, the first red marked line is formed between coordinates (2,0) and (2,10), and the second red-marked line is formed between coordinates (5,0) and (5,9). The area of water contained between these two lines is (height* width) = (5-2)* 9 = 27, which is the maximum area contained between any two lines present on the plane. So in this case, we will return 3* 9=27.
Problem approach

DP concepts

Try solving now

2. Minimum Travel Cost

Moderate
40m average time
65% success
0/80
Asked in companies
AmazonSamsungErnst & Young (EY)

Ninjaland is a country having 'N' states numbered from 1 to 'N'. These 'N' states are connected by 'M' bidirectional roads. Each road connects to different states and has some cost to travel from one state to another. Now, the chief wants you to select 'N' - 1 roads in such a way that the tourist bus can travel to every state at least once at minimum 'COST'.

For example :
Consider a country having 4 states numbered from 1 to 4. These 4 states are connected by 5 bidirectional roads given as :
1 --- 2 with cost = 8
2 --- 3 with cost = 6
3 --- 4 with cost = 5
1 --- 4 with cost = 2
1 --- 3 with cost = 4

The map of the country can be represented as:

Now, the best way to choose 3 roads is:

The cost of travelling from any state to all other states is  2 + 4 + 6 i.e. 12.
Problem approach

The approach is very simple: just travel by the bus with the lowest cost so far. Whenever a bus with an even lower cost is found, change the bus from that city. The following are the steps to solve:

  1. Start with the first city with a cost of C[1].
  2. Travel to the next city until a city j, having a cost lower than the previous city (city i), is found.
  3. Calculate the cost as abs(j – i) * C[i] and add it to the total cost so far.
  4. Repeat the previous steps until all the cities have been traversed.
Try solving now
02
Round
Easy
Face to Face
Duration60 mins
Interview date10 Dec 2021
Coding problem2

Face-to-face DSA online round was conducted on Google's platform.

1. First Missing Positive

Moderate
18m average time
84% success
0/80
Asked in companies
DunzoHikeSamsung

You are given an array 'ARR' of integers of length N. Your task is to find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can have negative numbers as well.

For example, the input [3, 4, -1, 1] should give output 2 because it is the smallest positive number that is missing in the input array.

Problem approach

Simple array implementation.

Try solving now

2. Simplify the Directory

Moderate
22m average time
70% success
0/80
Asked in companies
VisaGoldman SachsAmazon

You are given a path to a file/directory in Unix-style of length N, In a Unix-style file system, a dot(.) refers to the current directory. A double dot(..) refers to the previous directory in reference to the current directory. If there are multiple slashes between two directories you should consider it as a single slash.

Now, for a given directory path as a string, you are required to simplify the same and tell the final destination in the directory structure or the path.

The simplified path should always begin with a slash(/) and there must be a single slash between two directory names. There should not be a trailing slash.

Problem approach

I solved using Stack.

Try solving now
03
Round
Medium
Face to Face
Duration60 mins
Interview date10 Dec 2021
Coding problem2

Face-to-face DSA round, where I was asked 2 coding questions.

1. Pair Sum

Easy
15m average time
90% success
0/40
Asked in companies
Media.netExpedia GroupQuikr

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

Note:

Each pair should be sorted i.e the first value should be less than or equals to the second value. 

Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Problem approach
  • First, I gave the O(n^2) approach, and then he asked me to optimize it.
  • Then, I gave the map solution, and he was satisfied with the approach.
Try solving now

2. Frequency In A Sorted Array

Easy
15m average time
85% success
0/40
Asked in companies
SprinklrOlaUrban Company (UrbanClap)

You are given a sorted array 'ARR' and a number 'X'. Your task is to count the number of occurrences of 'X' in 'ARR'.

Note :
1. If 'X' is not found in the array, return 0.
2. The given array is sorted in non-decreasing order.
Problem approach
  1. Gave a map-based solution and asked me to optimize space and time.
  2. Gave a linear solution with a counter and no extra space.
  3. Gave a binary search-based solution with upper and lower bounds. The difference between the upper and lower bounds will give the frequency.
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
Software Engineer
4 rounds | 4 problems
Interviewed by Google inc
0 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 6 problems
Interviewed by Google inc
2438 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Google inc
2292 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 4 problems
Interviewed by Google inc
1492 views
1 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7976 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
10148 views
1 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
4448 views
1 comments
0 upvotes