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

Software Engineer

Google inc
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: Data structures, Algorithms, OOPS, OS, DBMS, Computer Networks, System Design
Tip
Tip

Tip 1 : Make sure you have your computer science fundamentals very clear.
Tip 2 : You should know the complexity of the code you write and should know the internal implementation of the data structure you use while coding.
Tip 3 : You should know about everything you write in your resume.
Tip 4 : Practice a lot of programming problems. Participate in competitive programming contests.

Application process
Where: Referral
Eligibility: Bachelor’s degree or equivalent practical experience.
Resume Tip
Resume tip

Tip 1 : Be honest about what you write in your resume.
Tip 2 : Should have at least 2 projects
Tip 3 : Maintain a precise and self-speaking one-page resume.
Tip 4 : Add technical achievements only.

Interview rounds

01
Round
Hard
Video Call
Duration60 minutes
Interview date8 Dec 2021
Coding problem2

The round was held in the morning, it was a telephonic interview on Google meet. The interviewer was very friendly and told me to relax and focus.

1. Regular Expression Matching

Hard
25m average time
80% success
0/120
Asked in companies
FacebookGrowwSAP Labs

Given an input string 'S' and a pattern 'P', implement a regular expression matching with the support of two special characters ‘.’ (dot) and ‘*’(asterisk) where

1. ‘.’ matches to any single character.
2. ‘*’ matches to zero or more of the preceding element.

If the input string 'S' matches the pattern 'P', then return true else, return false.

Note:
1. You have to match the entire string with the pattern given.

2. Both the strings, 'S' and 'P' contain only lower-case alphabets.

3. Only the pattern will contain additional characters ‘*’ and ‘.’ along with alphabets.
Problem approach

We define dp[i][j] to be true if s[0..i) matches p[0..j) and false otherwise. The state equations will be:

dp[i][j] = dp[i - 1][j - 1], if p[j - 1] != '*' && (s[i - 1] == p[j - 1] || p[j - 1] == '.');
dp[i][j] = dp[i][j - 2], if p[j - 1] == '*' and the pattern repeats for 0 time;
dp[i][j] = dp[i - 1][j] && (s[i - 1] == p[j - 2] || p[j - 2] == '.'), if p[j - 1] == '*' and the pattern repeats for at least 1 time.

Try solving now

2. Median in a stream

Hard
50m average time
50% success
0/120
Asked in companies
OlaInfo Edge India (Naukri.com)Samsung

Given that integers are read from a data stream. Your task is to find the median of the elements read so far.

Median is the middle value in an ordered integer list. If the size of the list is even there is no middle value. So the median is the floor of the average of the two middle values.

For example :
[2,3,4] - median is 3.
[2,3] - median is floor((2+3)/2) = 2.


Problem approach

we can use a max heap on the left side to represent elements that are less than effective median, and a min-heap on the right side to represent elements that are greater than effective median.

After processing an incoming element, the number of elements in heaps differs utmost by 1 element. When both heaps contain the same number of elements, we pick the average of heaps root data as effective median. When the heaps are not balanced, we select effective median from the root of the heap containing more elements.

Try solving now
02
Round
Hard
Video Call
Duration60 minutes
Interview date16 Dec 2022
Coding problem2

This round was held on Google meet in the morning.

1. Longest alternating subsequence

Moderate
15m average time
85% success
0/80
Asked in companies
DirectiAmazonBarclays

You are given an array ‘ARR’ of integers. Your task is to find the length of the longest alternating subsequence.

Note:
A sequence a1, a2, .... an is called an alternating sequence if its elements satisfy one of the following relations : a1 < a2 > a3 < a4 > a5..... or  a1 > a2 < a3 > a4 < a5.
For example:
'ARR' = {3, 10, 1, 2, 30}, the longest alternating subsequence for this array can be {3, 10, 1, 30} or {3, 10, 2, 30}. Therefore, the answer will be 4.
Try solving now

2. Decode String

Easy
15m average time
85% success
0/40
Asked in companies
Goldman SachsDelhiveryOla

You have been given an encoded string. Your task is to decode it back to the original string.

- An encoded string will be of the form <count>[encoded_string], where the 'encoded_string' inside the square brackets is being repeated exactly 'count' times. Note that 'count' is guaranteed to be a positive integer and can be greater than 9.
- There are no extra white spaces and square brackets are well-formed.
For example -
Input: 2[a]
“a” is encoded 2 times, hence the decoded string will be "aa".

Input: 3[a2[b]]
“b” is encoded 2 times, which decodes as 3[abb]. Now, "abb" is encoded 3 times, hence decoded string will be "abbabbabb". 
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
4 rounds | 4 problems
Interviewed by Google inc
5112 views
2 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
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