码迷,mamicode.com
首页 >  
搜索关键字:spell it right    ( 9304个结果
LC112 路径总和
终于自己做出来一道。。。 递归思路1 参考递归求解最大深度,构造新函数,将节点当前路径和当作额外参数传入 这个题比较特殊的地方在于,必须是叶子节点所在的路径才有效,因此在return true的条件中加入了left right均为`nullptr 返回时使用||不影响某个分支上的正确结果 class ...
分类:其他好文   时间:2020-07-16 21:13:09    阅读次数:43
0436. Find Right Interval (M)
Find Right Interval (M) 题目 Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than ...
分类:其他好文   时间:2020-07-16 12:10:10    阅读次数:63
扔硬币
扔硬币 题解: 1.如果\(\left ( m+k\right )> n\),那么就很明显答案为0; 2.根据条件概率:则题目就是求,在至少有\(m\)枚硬币是反面的情况下,恰好有\(k\)枚硬币是正面的概率。那么就可以设\(A\)为至少有\(m\)枚硬币是反面,\(B\)为恰好有\(k\)枚硬币是 ...
分类:其他好文   时间:2020-07-16 00:23:21    阅读次数:105
189. Rotate Array
Given an array, rotate the array to the right by k steps, where k is non-negative. Follow up: Try to come up as many solutions as you can, there are a ...
分类:其他好文   时间:2020-07-16 00:20:51    阅读次数:49
#树#递归#最大二叉树II
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { ...
分类:其他好文   时间:2020-07-16 00:01:06    阅读次数:61
#树#遍历#leetCode404.左子树之和
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ ...
分类:其他好文   时间:2020-07-15 23:40:01    阅读次数:70
#树#递归#二叉树的镜像
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ ...
分类:其他好文   时间:2020-07-15 23:31:48    阅读次数:66
leetcode 0404 二叉树检查平衡性 DFS
public boolean isBalanced(TreeNode root) { if (root == null) { return true; } int diff = getDepth(root.left) - getDepth(root.right); diff = diff > 0 ? ...
分类:其他好文   时间:2020-07-15 22:51:05    阅读次数:53
数据结构-树-二叉树遍历的实例-02
输出二叉树中的叶子结点 void PreOrderPrintLeaves( BinTree BT ) { if( BT ) { if ( !BT-Left && !BT->Right )// 在二叉树的遍历算法中增加检测结点的“左右子树是否都为空”。 printf(“%d”, BT->Data ); ...
分类:其他好文   时间:2020-07-15 15:28:16    阅读次数:72
Leetcode 116. 填充每个节点的下一个右侧节点指针
题目给定一个完美二叉树,其所有叶子节点都在同一层,每个父节点都有两个子节点。二叉树定义如下: struct Node {int val;Node *left;Node *right;Node *next;}填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 ...
分类:其他好文   时间:2020-07-15 01:06:48    阅读次数:77
9304条   上一页 1 ... 21 22 23 24 25 ... 931 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!