Google Interview question 2022 | phone, onsite | graph, DP
Anonymous User
14905

Telphonic round:
Given a 2d matrix with value 0 and -1. mat[i][j] == -1 is boundary pixel. Calculate the minimum distance of each node mat[i][j] from nearest boundary pixel.
e.g:-
0 0 0 0 0 0 0 0 0
0 0 -1 -1 0 0 0 0
0 -1 0 0 -1 -1 0 0
0 0 -1 0 0 0 -1 0 0
0 -1 0 0 0 -1 0 0 0
0 0 -1 -1 -1 0 0 0 0
0 0 0 0 0 0 0 0 0

Distance is calculated as |x1-x2| + |y1-y2|
mat[i][j] =
0 0 0
0 -1 0
0 0 0
Output:
mat[i][j]
2 1 2
1 0 1
2 1 2

Round 1: Coding Round
a) Delete a doubly linked list node using a key and update the head and tail.
b) Evaluate a postfix expression.

Round 2: Coding Round
Given a mXn grid with color value 0-7 and -1 which is final destination. A robot always starts from(0,0) and reach to destination.
Derive a direction mapping table to which robot can follow to reach destination. (East, West, North and South are only direction )

0 1 0 0
0 1 -1 4
0 1 0 3
0 2 0 3

Output:
0 -> E
1 -> S
2 -> E
3 -> N
4 ->W

Round 3: Coding Round
a) Given on-call rotation schedule for multiple people by: their name, start time and end time of the rotation:

Abby 1 10
Ben 5 7
Carla 6 12
David 15, 17

and given t = 9, return a list of names who are on call at time t.

Expected output: [Abby, Carla]

b) Return a rotation table without overlapping periods representing who are on call during that time. Return "Start time", "End time" and list of names:

1 5 Abby
5 6 Abby, Ben
6 7 Abby, Ben, Carla
7 10 Abby, Carla
10 12 Carla
15 17 David

Round 4: behavioural round
Googliness round:
a) Situation based question
b) What features would you like to add in google photo
c) How will you detect smile faces and write corner testcases for that?

Comments (18)