I have an object of class Person
public class Person {
....
private List<Person> people;
....
public List<Person> getPeople() {
return people;
}
public void setPeople(List<Person> people) {
this.people = people;
}

Each person has a list of all employees inside, and each person has a list of people underneath. How to find the maximum depth? for example, in this image, the maximum depth is 2. second in height is 1. Any rating is appreciated.
source
share