Description 给定一个 $n$ 个结点的树,每条边有两个属性:长度 $L$ 和花费 $D$。 现给定最大花费值 $m$,求出花费总和不超过 $m$ 的路径中长度的最大值。 Hint $1\le n\le 3\times 10^4, 1\le m\le 10^8, 1\le L,D\le 1 ...
分类:
其他好文 时间:
2020-05-08 22:55:56
阅读次数:
58
在通过create-react-app创建好react项目之后,npm start一直报错,如下: There might be a problem with the project dependency tree. It is likely not a bug in Create React Ap ...
分类:
移动开发 时间:
2020-05-08 18:19:55
阅读次数:
119
"Abstract:" In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left ...
分类:
其他好文 时间:
2020-05-08 18:11:11
阅读次数:
61
题目描述: 给定一个二叉树,它的每个结点都存放着一个整数值。 找出路径和等于给定数值的路径总数。 路径不需要从根节点开始,也不需要在叶子节点结束,但是路径方向必须是向下的(只能从父节点到子节点)。 二叉树不超过1000个节点,且节点数值范围是 [-1000000,1000000] 的整数。 示例: ...
分类:
其他好文 时间:
2020-05-08 16:24:26
阅读次数:
58
Matrix-Tree 定理作用:给定 n 个点 m 条边的无向图,求图的生成树个数。 定义矩阵K[i][j]=D[i][j]-A[i][j],(其中D为度数矩阵(即当i==j时,D[i][j]=节点 i 的度数,其余为0),A为邻接矩阵,有边相邻即为1,其余为0) 结论:对于已经得出的基尔霍夫矩阵 ...
分类:
其他好文 时间:
2020-05-08 13:10:58
阅读次数:
132
题目大意:一棵树,然后m个询问,每个询问有k个点,然后判断是否有一条路,要求这k个点要么在这条路上,要么和这条路相距为1. 题解:刚开始的思路是这样的,这条路的终点肯定是深度最深的那个点,然后用BFS找到从1到终点的路线,然后在对路径上的点和与路径直接相连的点进行判断,看这k个点是否都在其中,然后就 ...
分类:
其他好文 时间:
2020-05-08 13:06:29
阅读次数:
53
In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. Two nodes of a binary tree are cousins if they have ...
分类:
其他好文 时间:
2020-05-08 12:40:20
阅读次数:
59
Given a non-empty tree with root R, and with weight W?i?? assigned to each tree node T?i??. The weight of a path from R to L is defined to be the sum ...
分类:
其他好文 时间:
2020-05-07 23:06:39
阅读次数:
102
https://leetcode-cn.com/problems/subtree-of-another-tree/ 我们需要借助一个helper方法,这个思想就是双递归,即判断每个大树的节点和小树的根节点的值是否相等,如果相同就进入子树判断方法。否则就在大树节点的左节点和右节点查找。 helper方 ...
分类:
其他好文 时间:
2020-05-07 13:50:01
阅读次数:
58
https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/solution/li-jie-zhe-dao-ti-de-jie-shu-tiao-jian-by-user7208/ 思路:有个特殊情况,比如树是1,2.这样的话,根节点为 ...
分类:
其他好文 时间:
2020-05-07 10:48:03
阅读次数:
60