You have been given a CEO node under which there are various employees, and the are connected to the CEO with a tube which indicates time it takes to transfer the note , under these employees again there are several employees connected with a tube with the time it takes to reach the note.
Return that time at which all employees have received the notes.
example :
7
A--CEO
5 / \3
B D
6 /
C
Note : there was no left or right pointer, just a child pointer. So, you can probably traverse the tree using that pointer.
I'm sorry I can't remember all the details of Employee and Tube structure :(ans -> 11 as it takes 11 sec to reach from CEO ->B->C other tubes takes < 11 sec
I suggested doing dfs and summing all the time and then taking max of the sum that we got in the graph.
Then the interviewer gave a function template with structure as Employee and Tube, the Employee structure consisted children pointer and the Tube structure consisted time and next pointer. The graph was of Employee type (like vector CEO)
I don't exactly remember the structures format but it made the question a bit hard to implement. It took me a more time to actually understand what are the parameters of the structure and how she wanted me to use it.
I realized the question in itself isn't that difficult if I saw what structure format I have to follow, as I was thinking of implementing the DFS in my own style.
But it was fun to discuss and I would definitely feel it was a challenging code for a telephonic round.