Google Phone Screen | L3
Company: Google
Role: L3
Interview Stage: Phone Screen
Location: Bangalore
Year: unknown
Original Post Content:
Had my Google phone screen round in April for L3 role at Google Bangalore. Interviewer was from Georgia and asked a simple question.
Question:
Given entry node, corrupted node and network of nodes, for each node check if it is reachable or not. Corrupted node is a node where incoming is possible but outgoing is not possible.
Example:
entry node : 5
corrupted node : 3
network : [
[3],
[2,3],
[1,4],
[0,1,4],
[2,3,5],
[4]
]
Output: [False,True,True,True,True,True]
Few constraints that I cleared from Interviewer:
- entry node != corrupted node
- network will be single component connected undirected graph
Suggested BFS approach. Wrote code once Interviewer agreed with approach. Interviewer didn't ask any follow-up, seemed satisfied with the solution.
Got a rejection call after few days. Feedback mentioned "brute-force approach". Don't know what went wrong. Would be helpful if anyone can share an optimal approach for the above problem.
Felt really dumb :(