Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#...
分类:
其他好文 时间:
2015-02-13 21:12:18
阅读次数:
136
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:
其他好文 时间:
2015-02-11 16:23:02
阅读次数:
144
递归实现,深度遍历,记录每一条路径。
class Solution {
public:
int sumNumbers(TreeNode *root) {
if(root==nullptr)
return 0;
vector> result;
vector path;
traverse(root,result,path);
int n=result.size();...
分类:
其他好文 时间:
2015-02-10 13:20:24
阅读次数:
141
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2015-02-07 14:23:22
阅读次数:
169
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2015-02-05 23:15:41
阅读次数:
191
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.
难度系数:
容易
实现
int maxDepth(Tr...
分类:
其他好文 时间:
2015-02-05 16:28:31
阅读次数:
119
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7}...
分类:
其他好文 时间:
2015-02-05 16:27:50
阅读次数:
107
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2015-02-05 00:39:43
阅读次数:
144
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the tota...
分类:
其他好文 时间:
2015-02-04 21:57:07
阅读次数:
180
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and su...
分类:
其他好文 时间:
2015-02-03 23:08:01
阅读次数:
196