>_
max_depth.scala
Scala 3.6
Not run yet

+ 7 hidden

Input
root = [4, 2, 7, null, null, 6, 9, 5]
Expected
4

The longest path is 4 → 7 → 6 → 5, four nodes. The branch through 2 ends after two, and 9 after three.