BiTree Depth Calculation
BINARY TREE
DEPTH-FIRST SEARCH
Problem
Given a binary tree, find its maximum depth.
The maximum depth is defined as the longest path from the root node down to the farthest leaf node
Example 1
treeDepth([1,2,3,null,4,5]) // return 3
Example 2
treeDepth([1,2,3,null,null,null,4,5]) // return 4
Loading...
Loading...Loading...