题目描述
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.
代码
可以用DFS方法
1 |
public class { |
也可以用BFS
1 |
public class { |
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.
可以用DFS方法
1 |
public class { |
也可以用BFS
1 |
public class { |
近期评论