0104. Maximum Depth
Easy | Tree + Level-order Traversal | 24 ms (95.24%), 15.9 MB (92.41%)
Last updated
Was this helpful?
Easy | Tree + Level-order Traversal | 24 ms (95.24%), 15.9 MB (92.41%)
Last updated
Was this helpful?
Source: GitHub:
Given the root
of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
While traversing the tree in level order, we need to record the current level (depth).