Maximum Reporting Layer (Tree Height)

Asked at Rippling · Coding Questions · Difficulty: Easy

You are given a company reporting structure that forms a rooted tree with employees labeled `1..n`, where `1` is the CEO (the root). You are given `manager[i]` and `reportee[i]` pairs (there are `n-1` pairs), meaning `reportee[i]` directly reports to `manager[i]`. The pairs form a valid tree rooted at `1`.

Loading the problem…