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 sum
...
分类:
其他好文 时间:
2015-08-05 15:00:34
阅读次数:
112
题目:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ...
分类:
其他好文 时间:
2015-08-05 12:08:47
阅读次数:
92
题目: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 andsu...
分类:
其他好文 时间:
2015-08-05 06:38:24
阅读次数:
95
TreeTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %lluSubmit Status DescriptionYou are to determine the value of the leaf node in a g...
分类:
其他好文 时间:
2015-08-04 18:34:11
阅读次数:
99
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
编程语言 时间:
2015-08-03 16:44:18
阅读次数:
162
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2015-08-02 23:12:12
阅读次数:
219
简要代码
/*
* File : print binary tree road between leaf A and leaf B
* Date : 2015/8/2
* Author : jinya
* Assert A --> B
* traverse root , left , right ; left , root , right ; left , right , root...
分类:
其他好文 时间:
2015-08-02 16:54:43
阅读次数:
138
题目: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...
分类:
其他好文 时间:
2015-08-02 08:50:43
阅读次数:
91
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-08-01 23:27:33
阅读次数:
114
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即可。代码如下:
/**
* Defin...
分类:
其他好文 时间:
2015-08-01 22:08:25
阅读次数:
140