The interview was conducted on Google Docs and lasted 45 minutes.
The interviewer asked the following problem:
Distributed Communication Startup Problem
Google operates a distributed service consisting of multiple processes.
During startup, communication channels between processes become available gradually as different subsystems initialize. Once a communication channel becomes available, it remains available for the rest of the startup sequence.
A process can send a message to another process if there exists a chain of available communication channels connecting them.
Given the startup log and two process IDs, determine the earliest time at which the source process can successfully send a message to the destination process.
You are given:
n processes numbered from 0 to n-1
m communication channels
Each communication channel is represented as:
(processA, processB, activationTime)
meaning that beginning at activationTime, the two processes can communicate directly.
You are also given:
source destination
Return the earliest timestamp at which a message sent from source can reach destination.
Example:
n = 6
channels =
(0,1,2) (1,2,5) (0,3,3) (3,4,6) (4,5,7) (2,5,8)
source = 0 destination = 5
answer 7
( answer was not directly given i have to do the dry run of my code to arrive at that).
No constraints were given initially. The interviewer gradually revealed more details as the discussion progressed. I first discussed the brute-force approach and then moved toward the optimal solution.
I eventually arrived at the correct logic, but it happened quite late in the interview, and I wasn't able to finish coding the complete solution in time. Because of that, I wasn't able to make it through the process.
Still, it was a great learning experience.
All the best to everyone appearing for the process. Have fun, enjoy the experience, and make the most of the opportunity!