码迷,mamicode.com
首页 >  
搜索关键字:leaf    ( 924个结果
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. N ...
分类:其他好文   时间:2018-11-22 00:24:54    阅读次数:156
Solve Tree Problems Recursively
"Top-down" Solution Here is the pseudocode for the recursion function maximum_depth(root, depth): 1. return if root is null 2. if root is a leaf node: ...
分类:其他好文   时间:2018-11-21 19:35:40    阅读次数:115
872. Leaf-Similar Trees
1. Quesiton: 872. Leaf-Similar Trees url: https://leetcode.com/problems/leaf-similar-trees/description/ Consider all the leaves of a binary tree. From ...
分类:其他好文   时间:2018-11-17 23:20:29    阅读次数:198
CodeForces 1042 F Leaf Sets 贪心
Leaf Sets 题意:给你一棵树,树上有n个点,只有一条边的点叫做叶子,现在要求把所有的叶子分组,每个组内的所有叶子的距离都不能大于k。 题解: 我们可以随意找一个不是叶子的节点当做这颗树的根节点,这样这棵树中叶子就不会出现在上方了,现在我们先把所有的叶子都单独当做一个集合来。 假设现在我们在处 ...
分类:其他好文   时间:2018-11-15 17:16:03    阅读次数:190
872. Leaf-Similar Trees
https://leetcode.com/problems/leaf-similar-trees/discuss/152358/Simple-6-lines-Java-StringBuilder-+-traverse-with-explanation Consider all the leaves ... ...
分类:其他好文   时间:2018-11-08 18:30:29    阅读次数:148
CF 1042F Leaf Sets
贪心题 易证,在保证当前元素数量的前提下使一个大集合中的最长边最小时显然是最优情况 之后就是代码实现了 ...
分类:其他好文   时间:2018-10-30 00:19:00    阅读次数:168
python 面向对象十一 super函数
python 面向对象十一 super函数 super函数用来解决钻石继承。 一、python的继承以及调用父类成员 父类: class Base(object): def __init__(self): print("base init.") 普通方法调用父类: class Leaf(Base): ...
分类:编程语言   时间:2018-10-24 22:12:03    阅读次数:264
608 Tree Node
select id, case when p_id is null then 'Root ' when id in (select distinct p_id from tree where p_id is not null) then 'Inner' else 'leaf' end Type fr ...
分类:其他好文   时间:2018-10-22 12:58:53    阅读次数:169
Leaf-Similar Trees
Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t ...
分类:其他好文   时间:2018-10-15 12:04:24    阅读次数:129
CF1042F Leaf Sets
CF1042F Leaf Sets 题意翻译 给定一棵$n$个点的树,将叶子节点分为数个集合使集合里点对最长距离不超过$k$,求最少集合数。 输入输出格式 输入格式: The first line contains two integers $n$ and $k$ ( $3 \le n \le 10 ...
分类:其他好文   时间:2018-10-12 16:08:50    阅读次数:166
924条   上一页 1 ... 11 12 13 14 15 ... 93 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!