LeetCode
文章平均质量分 77
wlhwaii
the world of bugs...
展开
-
[LeetCode 113] Path Sum II
题目给定一个二叉树和一个目标和,找到所有从根节点到叶子节点路径总和等于给定目标和的路径。 说明:叶子节点是指没有子节点的节点。 示例: 给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 ...原创 2018-07-11 22:27:13 · 104 阅读 · 0 评论 -
[LeetCode 866] Smallest Subtree with all the Deepest Nodes
题目给定一个根为 root 的二叉树,每个结点的深度是它到根的最短距离。如果一个结点在整个树的任意结点之间具有最大的深度,则该结点是最深的。一个结点的子树是该结点加上它的所有后代的集合。返回能满足“以该结点为根的子树中包含所有最深的结点”这一条件的具有最大深度的结点。 示例:输入:[3,5,1,6,2,0,8,null,null,7,4]输出:[2,7,4]解释:...原创 2018-07-12 10:36:59 · 362 阅读 · 0 评论 -
[LeetCode 869] Reordered Power of 2
题目Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is not zero.Return true` if and only if we can do this in a way ...原创 2018-07-23 23:03:35 · 202 阅读 · 0 评论 -
[LeetCode 470] Implement Rand10() Using Rand7()
题目Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10.Do NOT use system’s Mat...原创 2018-07-19 00:40:41 · 747 阅读 · 0 评论 -
[LeetCode 871] Minimum Number of Refueling Stops
题目A car travels from a starting position to a destination which is target miles east of the starting position.Along the way, there are gas stations. Each stations[i] represents a gas station that...原创 2018-07-21 10:31:01 · 492 阅读 · 0 评论 -
[LeetCode 870] Advantage Shuffle
题目Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i].Return any permutation of A that maximizes its advantage with res...原创 2018-07-21 22:43:27 · 359 阅读 · 0 评论 -
[LeetCode 37] Sudoku Solver
题目A sequence X_1, X_2, ..., X_n is fibonacci-like if:n >= 3X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the...原创 2018-07-22 22:12:32 · 369 阅读 · 0 评论 -
[LeetCode 65] Valid Number
题目Validate if a given string can be interpreted as a decimal number.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true" -90e3原创 2019-01-30 14:18:31 · 183 阅读 · 0 评论