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...
分类:
其他好文 时间:
2014-09-21 08:55:00
阅读次数:
190
ExtJs 中默认对树节点图标控制的CSS代码:1 .x-tree-icon-leaf{width:16px;background-image:url('../../resources/themes/images/default/tree/leaf.gif')}2 .x-tree-icon-pare...
分类:
Web程序 时间:
2014-09-19 17:34:15
阅读次数:
236
[leetcode]Sum Root to Leaf Numbers...
分类:
其他好文 时间:
2014-09-19 12:05:04
阅读次数:
145
题目:
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.
AC率第二高的题啦,二项树的最长路径。初看此题...
分类:
其他好文 时间:
2014-09-17 20:26:52
阅读次数:
162
Path Sum
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...
分类:
其他好文 时间:
2014-09-15 17:54:12
阅读次数:
229
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 e...
分类:
其他好文 时间:
2014-09-15 14:13:38
阅读次数:
153
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 =...
分类:
其他好文 时间:
2014-09-13 20:05:35
阅读次数:
219
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...
分类:
其他好文 时间:
2014-09-13 20:04:45
阅读次数:
278
public class Solution { public int sumNumbers(TreeNode root) { int sum=0; TreeNode nowNode = root; Stack nodeStack = new Stack...
分类:
其他好文 时间:
2014-09-11 23:40:42
阅读次数:
224
说说:
哈哈,今天刷的题感觉难度不是很大嘛,淡淡地又刷了道树的题。其实还是简单的树的遍历。题目首先给你一个整数I,然后问你在root-to-leaf的值中有没有和I相等的,有输出yes,否则输出no。而root-to-leaf也就是从根到叶子节点的整条路径中,所有节点的值的和。解法自然是遍历整棵树,到达根后将root-to-leaf保存到一个数组中即可。具体的还是看代码好了~
源代码:
#i...
分类:
其他好文 时间:
2014-09-11 19:21:56
阅读次数:
178