12 2021 档案
[Leetcode 111]二叉树的最短深度 BFS/DFS
摘要:题目 给定二叉树,求最短路径包含的节点个数 https://leetcode.com/problems/minimum-depth-of-binary-tree/ Given a binary tree, find its minimum depth. The minimum depth is th 阅读全文
posted @ 2021-12-11 02:48 alau 阅读(57) 评论(0) 推荐(0)
[整理]String用法/转换substring
摘要:substring(a)从a开始 substring(a,b) [a,b] s=123456789 s.substring(3):456789 s.substring(0,3):1234 阅读全文
posted @ 2021-12-10 00:38 alau 阅读(81) 评论(0) 推荐(0)
[Leetcode 108]有序数组转BST二叉搜索树Convert Sorted Array to Binary Search Tree
摘要:题目 https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Given an integer array nums where the elements are sorted in ascending or 阅读全文
posted @ 2021-12-05 07:48 alau 阅读(28) 评论(0) 推荐(0)
[Leetcode 22]生成括号generate parentheses
摘要:题目 给定括号对数n,生成所有可能的标准括号结果* *指不能)( https://leetcode.com/problems/generate-parentheses/ Given n pairs of parentheses, write a function to generate all co 阅读全文
posted @ 2021-12-05 06:47 alau 阅读(41) 评论(0) 推荐(0)
[Leetcode 559]N叉树的最大深度Maximum Depth of N-ary Tree DFS/BFS模板
摘要:题目 https://leetcode.com/problems/maximum-depth-of-n-ary-tree/ N叉树的最大深度 Given a n-ary tree, find its maximum depth. The maximum depth is the number of 阅读全文
posted @ 2021-12-04 18:35 alau 阅读(42) 评论(0) 推荐(0)
[Leetcode 701]二叉搜索树BST中插入元素
摘要:题目 BST二叉搜索树中插入元素 二叉搜索树:左边<root<右边 https://leetcode.com/problems/insert-into-a-binary-search-tree/ You are given the root node of a binary search tree 阅读全文
posted @ 2021-12-04 08:10 alau 阅读(73) 评论(0) 推荐(0)
[Leetcode 235/236]LCA二叉树最近公共祖先Lowest Common Ancestor of a Binary Tree
摘要:题目 给定二叉树和两个点,求两点的LCA最近公共祖先 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of L 阅读全文
posted @ 2021-12-04 02:54 alau 阅读(57) 评论(0) 推荐(0)
[Leetcode 98]判断有效的二叉搜索树Validate Binary Search Tree
摘要:题目 https://leetcode.com/problems/validate-binary-search-tree 判断所给二叉树是否是二叉搜索树 二叉搜索树:其值left<root<right *[2,2,2]这种相等的情况也不是搜索树 Given the root of a binary 阅读全文
posted @ 2021-12-03 23:41 alau 阅读(52) 评论(0) 推荐(0)
[Leetcode 104]二叉树最大深度Maximum Depth of Binary Tree
摘要:题目 求二叉树的深度,即根节点出发的最长路径上点的个数,即最长路径+1(本身这个点 https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given the root of a binary tree, return its maxi 阅读全文
posted @ 2021-12-03 17:51 alau 阅读(40) 评论(0) 推荐(0)