码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果
求二叉树的最大深度
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r ...
分类:其他好文   时间:2020-07-17 13:55:38    阅读次数:71
#树#递归#最大二叉树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
LeetCode 700.二叉树中的搜索
题目描述链接:https://leetcode-cn.com/problems/search-in-a-binary-search-tree/ 基本思路:等于返回,当前节点值大于搜索值从左子树搜索,小于从右子树搜索。以此可以用递归或迭代法实现,下面分别展示两种方法; (1)采用递归的方法 LeetC ...
分类:其他好文   时间:2020-07-15 23:43:11    阅读次数:76
#树#遍历#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 96. 不同的二叉搜索树 | Python
96. 不同的二叉搜索树 题目来源:力扣(LeetCode)https://leetcode-cn.com/problems/unique-binary-search-trees 题目 给定一个整数 n,求以 1 ... n 为节点组成的二叉搜索树有多少种? 示例: 输入: 3 输出: 5 解释: ...
分类:编程语言   时间:2020-07-15 23:11:39    阅读次数:74
[PAT] A1043 Is It a Binary Search Tree
(熟练!重要!)二叉搜索树 BST ##题目大意 判断给定序列是否是一个BST或镜像BST树的先序遍历序列,如果是则输出该树的后序遍历序列。 ##思路 根据给定序列创建BST树,求出它的先序遍历和镜像树的先序遍历(即原树遍历时按照根->右->左),与原序列比较。 ##AC代码 #define _CR ...
分类:其他好文   时间:2020-07-14 11:52:38    阅读次数:62
LeetCode94二叉树中序遍历
题目链接 https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ 题解一:递归 // Problem: LeetCode 94 // URL: https://leetcode-cn.com/problems/binary-tr ...
分类:其他好文   时间:2020-07-13 15:36:49    阅读次数:58
1513. Number of Substrings With Only 1s
Given a binary string s (a string consisting only of '0' and '1's). Return the number of substrings with all characters 1's. Since the answer may be t ...
分类:其他好文   时间:2020-07-13 09:56:37    阅读次数:68
[LeetCode] 1513. Number of Substrings With Only 1s
Given a binary string s (a string consisting only of '0' and '1's). Return the number of substrings with all characters 1's. Since the answer may be t ...
分类:其他好文   时间:2020-07-13 09:45:45    阅读次数:61
11734条   上一页 1 ... 24 25 26 27 28 ... 1174 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!