Google AI Residency | Phone | N-ary Tree

Had a one-hour first phone interview for Google AI Residency.

  1. A bit about me
  2. Why did you apply to this opening? And what all do you know about this program?
  3. Problem

Problem

A CEO wants to notify all of its employees about something, but CEO can only inform it's immediate and direct reporters working under him. Who in turn will report it's set of direct reporters and this shall go on till all employees learn about the news. But, each person receiving the information and passing it to his/her direct reporters can take N days to pass it on.
What is the minimum number of days taken for CEO to pass news from him/her to rest of the employees.

Implemented a n-ary tree structure, each level reporting the max value added to the parent's value and a recursion for all nodes. My approach was perfect as the interviewer mentioned but might have slipped a bit of value handling in implementation due to nervousness. Not sure how much would that be penalised for!

Comments (2)