Virtual Onsite 2:-
class Employee{
String name;
String dept;
List<Employee> reports;
}
public int getMinTimeToSendMessageToAllEmployees(List<Employee> employees){
}I needed to complete this function where we dont know who is CEO/BOSS (root) among the list of emplyees. I got the approach, interviewer was also satisfied but I was not able to come up with the working code in time.
Can someone please post the solution
My approach:-