ICode9

精准搜索请尝试: 精确搜索
  • LeetCode 98. Validate Binary Search Tree2022-06-04 17:33:06

    LeetCode 98. Validate Binary Search Tree (验证二叉搜索树) 题目 链接 https://leetcode.cn/problems/validate-binary-search-tree/ 问题描述 给你一个二叉树的根节点 root ,判断其是否是一个有效的二叉搜索树。 有效 二叉搜索树定义如下: 节点的左子树只包含 小于 当前节点的数

  • xshelll rz上传文件乱码2022-06-04 17:01:09

    原因:文件中含有控制字符 解决方案: 使用 rz -be -b:–binary 用binary的方式上传下载,不解释字符为ascii; -e:–escape 强制escape 所有控制字符,比如Ctrl+x,DEL等 解压文件: tar -zxvf

  • LeetCode 700. Search in a Binary Search Tree2022-06-03 16:33:08

    LeetCode 700. Search in a Binary Search Tree (二叉搜索树中的搜索) 题目 链接 https://leetcode.cn/problems/search-in-a-binary-search-tree/ 问题描述 给定二叉搜索树(BST)的根节点 root 和一个整数值 val。 你需要在 BST 中找到节点值等于 val 的节点。 返回以该节点为

  • LeetCode 0199 Binary Tree Right Side View2022-06-02 08:34:11

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 DFS. 对树进行先序遍历,在搜索过程中,总是先访问右子树,根 -> 右 -> 左。那么对于每层来说,在这层见到的第一个结点一定是最右边的结点。 2、代码实现 package Q0199.Q0199BinaryTreeRightSideView; import DataStructure.TreeNod

  • [DSAAinC++] 树的概念2022-06-01 01:01:52

    0. 注意事项与声明 本文摘录整理自 Data Structures, Algorithms, and Applications in C++. 作者: JamesNULLiu 邮箱: jamesnulliu@outlook.com 博客: www.cnblogs.com/jamesnulliu/ 学习笔记 请注明出处 欢迎留言 1. 中英词汇对应表 树 tree 二叉树 binary tree 完全二叉树

  • LeetCode 111 Minimum Depth of Binary Tree BFS2022-05-28 15:02:08

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. Solution 用 \(queue\) 将元素压入队列,然后每次循环该层的所有

  • 数据结构之二叉树(Binary Tree)_python实现2022-05-23 20:32:08

    1.二叉树的类定义 2.二叉树的基本性质 3.遍历二叉树       3.1前序遍历       3.2中序遍历       3.3后序遍历       3.4层次遍历 4.二叉树的应用       4.1二叉搜索树       4.2平衡二叉树       4.3红黑树       4.4线段树  

  • mysql字符集介绍以及对应的校对规则2022-05-23 15:04:01

    字符集是什么:   字符集是指一种从二进制编码到某类字符符号的映射,每一类编码字符都有其对应的字符集和校对规则.每种字符集都可能有多种校对规则,并且都有一个默认的校对规则 校对是什么:   “校对”是指一组用于某个字符集的排序规则,对于校对规则通常需要考虑的一个问题是,

  • LeetCode 0144 Binary Tree Preorder Traversal2022-05-23 08:33:30

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 先序遍历: 根左右,递归实现。 2、代码实现 package Q0199.Q0144BinaryTreePreorderTraversal; import DataStructure.TreeNode; import java.util.ArrayList; import java.util.List; /* 先序遍历: 根左右 method 1:

  • LeetCode 0145 Binary Tree Postorder Traversal2022-05-23 08:32:52

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 后序遍历,左右根,递归实现。 2、代码实现 package Q0199.Q0145BinaryTreePostorderTraversal; import DataStructure.TreeNode; import java.util.ArrayList; import java.util.List; public class Solution { public Lis

  • PHP接口报错:Unable to init from given binary data2022-05-21 12:02:01

    前因:   事情是这样的,前几天不是使用Laravel做了一个图片比对的功能么,因为需要安装Composer扩展,并且这个扩展的使用,需要开启PHP的GD库的扩展支持。   所以本地以及都调试好了,于是今天就上线。然后问题就来了,上线后,请求测试方法,接口直接报 500了。 后果:   因为是线上环境,所以

  • C. Binary String2022-05-16 15:03:03

    C. Binary String https://codeforces.ml/contest/1680/problem/C 题意 给你一个01字符串 可以选择再最前面和最后面删除若干个0或1 然后取剩余的0的个数和删去的个数中较大的那个数作为答案 求最小答案 思路 二分 + 双指针 也可以直接双指针 二分答案 首先预处理计算出01串中1的

  • LeetCode 98 Validate Binary Search Tree DFS2022-05-16 06:31:25

    Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nod

  • LeetCode 104 Maximum Depth of Binary Tree DFS2022-05-16 02:01:57

    Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Solution 很基础的 \(DFS\): \(\text{dfs}(root,depth)\)。当没有左右子节点时

  • LeetCode 0104 Maximum Depth of Binary Tree2022-05-11 09:03:07

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 递归实现 1> 递归出口。遍历当前结点为空,返回0。 2> 递归分解。当前高度=max{左子树高度,右子树高度} +1。 2、代码实现 package Q0199.Q0104MaximumDepthofBinaryTree; import DataStructure.TreeNode; /* Depth first s

  • MySQL如何区分大小写2022-05-10 10:00:36

    MySQL CRUD 问题描述 mysql在Windows下是不区分大小写的,而Linux下区分大小写,Windows下将script文件导入MySQL后表名也会自动转化为小写,如果导入Linux服务器中使用就会发生错误。 如何在Windows下让它区分大小写呢? 三种方法,任选一种即可 需要设置collate(校对) 这个可以在建表的时

  • LeetCode 0103 Binary Tree Zigzag Level Order Traversal2022-05-10 09:04:22

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 使用BFS+递归,逐层遍历树,若当前层level为奇数,头插结点;若当前level为偶数,尾插结点。 2、代码实现 package Q0199.Q0103BinaryTreeZigzagLevelOrderTraversal; import DataStructure.TreeNode; import java.util.ArrayList; imp

  • LeetCode 0102 Binary Tree Level Order Traversal2022-05-09 09:04:45

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 迭代法,使用队列。 2、代码实现 package Q0199.Q0102BinaryTreeLevelOrderTraversal; import DataStructure.TreeNode; import java.util.LinkedList; import java.util.List; import java.util.Queue; public class Solutio

  • LeetCode 0096 Unique Binary Search Trees2022-05-06 07:31:44

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 定义两个函数 G(n): 长度为n的序列能构成的不同二叉搜索树的个数。 F(i, n): 以i为根、序列长度为n的不同二叉搜索树个数(1 <= i <= n) G(n) = sum{F(i, n)} i in [1, n] 对于边界情况,当序列长度为1(只有根)或为0(空树): G(0)

  • LeetCode 0095 Unique Binary Search Trees II2022-05-05 07:31:34

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 利用BST的中序遍历为递增序:遍历 1 ~ n,工作变量为i。设genTrees(int start, int end) 为构造树的方法 若i为根结点,则 left =genTrees(1, i - 1); right = genTrees(i + 1, n)。 2、代码实现 package Q0099.Q0095UniqueBinarySea

  • LeetCode 0094 Binary Tree Inorder Traversal2022-05-05 07:00:57

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 中序遍历:左、根、右。递归实现 2、代码实现 package Q0099.Q0094BinaryTreeInorderTraversal; import DataStructure.TreeNode; import java.util.ArrayList; import java.util.List; public class Solution1 { /*

  • Halcon-图像处理-二值化-binary_threshold2022-04-24 14:35:57

    binary_threshold——用二进制阈值来分割图像。 Halcon算子原型:binary_threshold(Image : Region : Method, LightDark : UsedThreshold)参数:Image:需要进行阈值的图像Region:处理后的区域Method:分割方法('max_separability':最大限度的可分性, 'smooth_histo':直方图平滑)LightDar

  • Leetcode 868 二进制间距2022-04-24 13:03:28

    每日一题 Day2 题目描述 Given a positive integer n, find and return the longest distance between any two adjacent 1's in the binary representation of n. If there are no two adjacent 1's, return 0. 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/binar

  • LeetCode 1676. Lowest Common Ancestor of a Binary Tree IV2022-04-24 11:31:35

    原题链接在这里:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-iv/ 题目: Given the root of a binary tree and an array of TreeNode objects nodes, return the lowest common ancestor (LCA) of all the nodes in nodes. All the nodes will

  • LeetCode 1650. Lowest Common Ancestor of a Binary Tree III2022-04-24 10:33:24

    原题链接在这里:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-iii/ 题目: Given two nodes of a binary tree p and q, return their lowest common ancestor (LCA). Each node will have a reference to its parent node. The definition for No

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有