微博:http://www.weibo.com/cathyhwzn
刷题必备书籍:Cracking the Coding Interview: 150 Programming Questions and Solutions
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.
简单题,就是递归然后计算长度,但是要用queue来存储暂时的node。和上几题思路都是一样的,还是 BFS.
Hi,
ReplyDeleteI am struggling on this question. Do you know how to solve it using dfs in an iterative way?
Thanks
Terry
Hi, I don't think it's suitable here to use DFS.
Delete