Total Accepted: 120354
Total Submissions: 255664
Difficulty: Easy
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
一种是递归后序遍历树,返回深度,一种是层次遍历,有几层便是深度。
C++:
1 | * Definition for a binary tree node. |