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
Preparation
Duration: 1 month
Topics: DSA, Algorithms, Trees, Graphs, Dynamic Programming, Greedy
Tip
Tip

Tip 1 : Practice DSA very very well
Tip 2 : Try competitive programming
Tip 3 : Also try to get better in explaining the apporach

Application process
Where: Referral
Eligibility: it was for 2023 grads
Resume Tip
Resume tip

Tip 1 : Write only what you have actually done
Tip 2 : Have a balanced resume with something you are very good at and rest above average

Interview rounds

01
Round
Medium
Video Call
Duration45 minutes
Interview date20 Aug 2022
Coding problem2

it was at 12pm, the interviewer was a male, and was making me very comfortable.

1. Topological Sorting

Moderate
30m average time
60% success
0/80
Asked in companies
AmazonExpedia GroupMorgan Stanley

Given a DAG(direct acyclic graph), return the Topological Sorting of a given graph.

Problem approach

A DAG G has at least one vertex with in-degree 0 and one vertex with out-degree 0.

Try solving now

2. Trapping Rain Water

Moderate
15m average time
80% success
0/80
Asked in companies
HCL TechnologiesCiti BankAtlassian

You have been given a long type array/list 'arr’ of size 'n’.


It represents an elevation map wherein 'arr[i]’ denotes the elevation of the 'ith' bar.



Note :
The width of each bar is the same and is equal to 1.
Example:
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].

Output: 10

Explanation: Refer to the image for better comprehension:

Alt Text

Note :
You don't need to print anything. It has already been taken care of. Just implement the given function.
Problem approach

Find maximum height of bar from the left end upto an index i in the array left_max.
Find maximum height of bar from the right end upto an index i in the array right_max.
Iterate over the \text{height}height array and update ans:
Add min(left_max[i],right_max[i]) - height[i] to ans

Try solving now
02
Round
Medium
Video Call
Duration45 minutes
Interview date27 Aug 2022
Coding problem2

It was at 4pm, the interviewer was a male and was very friendly

1. Job Sequencing Problem

Moderate
30m average time
70% success
0/80
Asked in companies
MicrosoftOlaMorgan Stanley

You are given a 'Nx3' 2-D array 'Jobs' describing 'N' jobs where 'Jobs[i][0]' denotes the id of 'i-th' job, 'Jobs[i][1]' denotes the deadline of 'i-th' job, and 'Jobs[i][2]' denotes the profit associated with 'i-th job'.


You will make a particular profit if you complete the job within the deadline associated with it. Each job takes 1 unit of time to be completed, and you can schedule only one job at a particular time.


Return the number of jobs to be done to get maximum profit.


Note :
If a particular job has a deadline 'x', it means that it needs to be completed at any time before 'x'.

Assume that the start time is 0.


For Example :
'N' = 3, Jobs = [[1, 1, 30], [2, 3, 40], [3, 2, 10]].

All the jobs have different deadlines. So we can complete all the jobs.

At time 0-1, Job 1 will complete.
At time 1-2, Job 3 will complete.
At time 2-3, Job 2 will complete.

So our answer is [3 80].
Problem approach

Greedily choose the jobs with maximum profit first, by sorting the jobs in decreasing order of their profit. This would help to maximize the total profit as choosing the job with maximum profit for every time slot will eventually maximize the total profit

Try solving now

2. Painter's Partition Problem

Moderate
25m average time
75% success
0/80
Asked in companies
OYOHSBCPayPal

Given an array/list of length ‘n’, where the array/list represents the boards and each element of the given array/list represents the length of each board. Some ‘k’ numbers of painters are available to paint these boards. Consider that each unit of a board takes 1 unit of time to paint.


You are supposed to return the area of the minimum time to get this job done of painting all the ‘n’ boards under a constraint that any painter will only paint the continuous sections of boards.


Example :
Input: arr = [2, 1, 5, 6, 2, 3], k = 2

Output: 11

Explanation:
First painter can paint boards 1 to 3 in 8 units of time and the second painter can paint boards 4-6 in 11 units of time. Thus both painters will paint all the boards in max(8,11) = 11 units of time. It can be shown that all the boards can't be painted in less than 11 units of time.


Try solving now
03
Round
Medium
Video Call
Duration45 minutes
Interview date28 Aug 2022
Coding problem2

it was at 3 pm, male interviewer, looked like an experienced employee

1. Water Supply In A Village

Hard
45m average time
55% success
0/120
Asked in companies
SamsungAppleFacebook

There are ‘N’ houses in a village. Ninja wants to supply water for all the houses by building wells and laying pipes.

For each house ‘i’, we can either build a well inside it directly with cost ‘WELLS[i]’, or pipe in water from another well to it. The total cost to lay pipes between houses is given by the array ‘PIPES’, where ‘PIPES[i]’ = ‘[HOUSE1, HOUSE2, COST]’ and the ‘COST’ represent the total cost connect ‘HOUSE1’ and ‘HOUSE2’ together using a pipe.

Note: Given all the connections are bidirectional.

For Example:

For ‘N’ = 3, ‘WELLS[]’ = ‘[1,2,2]’, ‘PIPES[]’ = [ [1, 2, 1], [2 , 3, 1]]. The image shows the costs of connecting houses using pipes. The best strategy is to build a well in the first house with cost 1 and connect the other houses to it with cost 2 so the total cost is 3.

img

Ninja wants to find out the minimum total cost to supply water to all houses in the village. Can you help the Ninja to find out this minimum cost?

Try solving now

2. Count Subarrays with Given XOR

Moderate
15m average time
85% success
0/80
Asked in companies
ArcesiumUberCIS - Cyber Infrastructure

Given an array of integers ‘ARR’ and an integer ‘X’, you are supposed to find the number of subarrays of 'ARR' which have bitwise XOR of the elements equal to 'X'.

Note:
An array ‘B’ is a subarray of an array ‘A’ if ‘B’ that can be obtained by deletion of, several elements(possibly none) from the start of ‘A’ and several elements(possibly none) from the end of ‘A’. 
Problem approach

As we know a ^ a =0 . When we write all substrings, we have to check how many numbers occur an even number of times and how many numbers occur an odd number of times. If the list is 0 indexed, the number at ith index will occur (i+1)*(n-i) times.

If n is even, either i+1 or n-i will be even. Each number will occur an even number of times, and the answer will be 0. If n is odd and i is even, the product of the XOR will be odd. In that case, the answer is the XOR of the even indexed elements.

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
1493 views
1 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7977 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