0104. Maximum Depth
Easy | Tree + Level-order Traversal | 24 ms (95.24%), 15.9 MB (92.41%)
Source: LeetCode - Maximum Depth of Binary Tree GitHub: Solution / Performance
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.
Extension question of Level-order traversal.
While traversing the tree in level order, we need to record the current level (depth).
Last updated