5区的秋菜,不经霜也是很甜的!# gardening - 拈花惹草
c*n
1 楼
Finding deepest node of tree??
Here is a solution:
- First to find the height of the tree.(do it recursively, O(n) time)
- Then traverses through each node, find the current depth and compare
it with the maxDepth.
- If condition satisfied, print out the item stored in the node.
这是最好方法么?
Here is a solution:
- First to find the height of the tree.(do it recursively, O(n) time)
- Then traverses through each node, find the current depth and compare
it with the maxDepth.
- If condition satisfied, print out the item stored in the node.
这是最好方法么?