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 and
sum = 22,
5
...
分类:
其他好文 时间:
2014-06-15 19:55:39
阅读次数:
191
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the f...
分类:
其他好文 时间:
2014-06-15 19:49:35
阅读次数:
176
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
...
分类:
其他好文 时间:
2014-06-15 19:26:23
阅读次数:
207
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:
其他好文 时间:
2014-06-15 18:55:36
阅读次数:
188
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.
此题和求二叉树的最短路径几乎一模一样。
public int...
分类:
其他好文 时间:
2014-06-15 16:36:40
阅读次数:
209
接上一篇《导出Excel1 - 项目分解篇》,介绍3个子过程。
1. treeADO
说明:把数据表字段转化为Tree结构
声明:procedure treeADO(adoDataSetX:TADODataSet;tvTemplate1:TTreeView);
实现:
proced...
分类:
其他好文 时间:
2014-06-15 15:45:40
阅读次数:
182
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 bin...
分类:
其他好文 时间:
2014-06-15 09:34:35
阅读次数:
226
这个题目给定一棵树,以及树的每个树枝的苹果数量,要求在保留K个树枝的情况下最多能保留多少个苹果一看就觉得是个树形DP,然后想出 dp[i][j]来表示第i个节点保留j个树枝的最大苹果数,但是在树形过程中,有点难表示转移后来看了下大神的做法才知道其实可以用背包来模拟 树枝的去留,其实真的是个背包诶,每...
分类:
移动开发 时间:
2014-06-15 07:48:55
阅读次数:
244
题目:Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ...
分类:
其他好文 时间:
2014-06-15 00:53:09
阅读次数:
314
题目:
链接:点击打开链接
题意:
输入n个点,要求选m个点满足连接m个点的m-1条边权值和sum与点的权值和ans最小,即sum/ans最小,并输出所选的m个点,如果有多种情况就选第一个点最小的,如果第一个点也相同就选第二个点最小的........
求一个图中的一颗子树,使得Sum(edge weight)/Sum(point weight)最小~
数据...
分类:
其他好文 时间:
2014-06-14 07:05:34
阅读次数:
350