- 博客(342)
- 资源 (4)
- 收藏
- 关注
原创 Linux学习笔记
----Linux开山篇-01_内容介绍02_学习方向03_应用领域04_学习阶段和方法分享---Linux基础篇-05_Linux介绍06_Linux和Unix的关系07_Linux和Windows的比较08_VMWare的安装和说明09_CentOS的安装和说明10_终端使用和联网11_vmtools的安装和使用12_文件系统目录结构--Linux实操篇-13_远程登录XShell514_远程上传下载...
2021-07-05 02:56:23
7193
16
原创 LeetCode - Medium - 1104. Path In Zigzag Labelled Binary Tree
TopicMathBinary TreeDescriptionhttps://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/In an infinite binary tree where every node has two children, the nodes are labelled in row order.In the odd numbered rows (ie., the first, third, fift
2021-07-01 16:58:24
234
原创 LeetCode - Medium - 1382. Balance a Binary Search Tree
TopicDivide and ConquerBinary Search TreeDepth-First SearchDescriptionhttps://leetcode.com/problems/balance-a-binary-search-tree/Given a binary search tree, return a balanced binary search tree with the same node values.A binary search tree is bal
2021-07-01 02:36:07
233
原创 LeetCode - Easy - 703. Kth Largest Element in a Stream
TopicDesignBinary Search TreeHeap (Priority Queue)Descriptionhttps://leetcode.com/problems/kth-largest-element-in-a-stream/Design a class to find the kthk^{th}kth largest element in a stream. Note that it is the kthk^{th}kth largest element in the
2021-06-30 14:37:46
211
原创 LeetCode - Medium - 1367. Linked List in Binary Tree
TopicLinked ListTreeDepth-First SearchBinary TreeDescriptionhttps://leetcode.com/problems/linked-list-in-binary-tree/Given a binary tree root and a linked list with head as the first node.Return True if all the elements in the linked list startin
2021-06-30 00:22:49
246
原创 KMP子字符串匹配算法学习笔记
文章目录学习资源什么是KMP什么是前缀表为什么一定要用前缀表如何计算前缀表前缀表有什么问题使用next数组来匹配放码过来构造next数组一、初始化二、处理前后缀不相同的情况三、处理前后缀相同的情况使用next数组来做匹配代码总览测试代码时间复杂度分析学习资源字符串:KMP是时候上场了(一文读懂系列)- 代码随想录字符串:都来看看KMP的看家本领!- 代码随想录什么是KMPKMP算法是由这三位学者发明的:Knuth,Morris和Pratt,因此,用这三位学者名字的首字母组合成,来命名该算法
2021-06-27 12:46:08
340
1
原创 LeetCode - Medium - 109. Convert Sorted List to Binary Search Tree
TopicLinked ListDivide and ConquerTreeBinary Search TreeBinary TreeDescriptionhttps://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/Given the head of a singly linked list where elements are sorted in ascending order, convert it
2021-06-27 01:45:55
217
原创 LeetCode - Medium - 1161. Maximum Level Sum of a Binary Tree
TopicTreeBreadth-First SearchDescriptionhttps://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on.Return the smallest level x such that th
2021-06-25 12:35:41
182
原创 LeetCode - Medium - 1123. Lowest Common Ancestor of Deepest Leaves
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/lowest-common-ancestor-of-deepest-leaves/Given the root of a binary tree, return the lowest common ancestor of its deepest leaves.Recall that:The node of a binary tree is a leaf
2021-06-23 10:56:36
208
原创 LeetCode - Medium - 865. Smallest Subtree with all the Deepest Nodes
TopicTreeDepth-first SearchBreadth-first SearchRecursionDescriptionhttps://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/Given the root of a binary tree, the depth of each node is the shortest distance to the root.Return the s
2021-06-23 03:32:04
216
原创 LeetCode - Medium - 1026. Maximum Difference Between Node and Ancestor
TopicTreeDepth-first SearchDescriptionLeetCode - Medium - 1026. Maximum Difference Between Node and AncestorGiven the root of a binary tree, find the maximum value V for which there exist different nodes A and B where V = |A.val - B.val| and A is an
2021-06-22 13:36:52
215
原创 LeetCode - Medium - 1130. Minimum Cost Tree From Leaf Values
TopicDynamic ProgrammingStackTreeDescriptionhttps://leetcode.com/problems/minimum-cost-tree-from-leaf-values/Given an array arr of positive integers, consider all binary trees such that:Each node has either 0 or 2 children;The values of arr corr
2021-06-22 04:55:10
363
原创 LeetCode - Medium - 1315. Sum of Nodes with Even-Valued Grandparent
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/sum-of-nodes-with-even-valued-grandparent/Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent,
2021-06-21 12:46:00
185
原创 LeetCode - Hard - 297. Serialize and Deserialize Binary Tree
TopicTreeDesignDescriptionhttps://leetcode.com/problems/serialize-and-deserialize-binary-tree/Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or trans
2021-06-21 12:28:59
320
原创 LeetCode - Medium - 449. Serialize and Deserialize BST
TopicTreeDescriptionhttps://leetcode.com/problems/serialize-and-deserialize-bst/Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connec
2021-06-21 01:25:44
248
原创 LeetCode - Medium - 652. Find Duplicate Subtrees
TopicTreeDescriptionhttps://leetcode.com/problems/find-duplicate-subtrees/Given the root of a binary tree, return all duplicate subtrees.For each kind of duplicate subtrees, you only need to return the root node of any one of them.Two trees are dup
2021-06-20 21:10:37
224
原创 LeetCode - Medium - 814. Binary Tree Pruning
TopicTreeDescriptionhttps://leetcode.com/problems/binary-tree-pruning/Given the root of a binary tree, return the same tree where every subtree (of the given tree) not containing a 1 has been removed.A subtree of a node node is node plus every node
2021-06-20 14:19:09
200
原创 二叉树遍历算法总结
文章目录前提要素深度优先搜索DFS经典遍历算法前序遍历递归版迭代版中序遍历递归版迭代版后序遍历递归版迭代版Morris遍历算法中序遍历前序遍历后序遍历广度优先搜索BFS按层遍历参考资料前提要素//二叉树节点结构public static class TreeNode { public int val; public TreeNode left; public TreeNode right; public TreeNode(int x) { val = x; } public Tre
2021-06-20 03:49:52
999
原创 LeetCode - Medium - 236. Lowest Common Ancestor of a Binary Tree
TopicTreeDescriptionhttps://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common a
2021-06-19 22:14:26
222
原创 LeetCode - Medium - 1008. Construct Binary Search Tree from Preorder Traversal
TopicTreeDescriptionhttps://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its
2021-06-19 16:46:18
234
原创 LeetCode - Medium - 1372. Longest ZigZag Path in a Binary Tree
TopicDynamic ProgrammingTreeDescriptionhttps://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree/You are given the root of a binary tree.A ZigZag path for a binary tree is defined as follow:Choose any node in the binary tree and a direct
2021-06-19 12:23:40
241
原创 LeetCode - Medium - 894. All Possible Full Binary Trees
TopicTreeRecursionDescriptionhttps://leetcode.com/problems/all-possible-full-binary-trees/Given an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0.Each element of
2021-06-19 01:27:58
214
原创 LeetCode - Medium - 1448. Count Good Nodes in Binary Tree
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/count-good-nodes-in-binary-tree/Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.Return the
2021-06-18 15:24:46
199
原创 LeetCode - Medium - 701. Insert into a Binary Search Tree
TopicTreeDescriptionhttps://leetcode.com/problems/insert-into-a-binary-search-tree/You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed th
2021-06-18 03:32:29
402
原创 LeetCode - Medium - 116. Populating Next Right Pointers in Each Node
TopicTreeDepth-first SearchBreadth-first SearchDescriptionhttps://leetcode.com/problems/populating-next-right-pointers-in-each-node/You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The b
2021-06-17 23:30:21
199
原创 LeetCode - Hard - 1028. Recover a Tree From Preorder Traversal
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/recover-a-tree-from-preorder-traversal/We run a preorder depth-first search (DFS) on the root of a binary tree.At each node in this traversal, we output D dashes (where D is the de
2021-06-17 12:54:40
213
原创 LeetCode - Medium - 222. Count Complete Tree Nodes
TopicBinary SearchTreeDescriptionhttps://leetcode.com/problems/count-complete-tree-nodes/Given the root of a complete binary tree, return the number of the nodes in the tree.According to Wikipedia, every level, except possibly the last, is complete
2021-06-17 00:44:58
263
原创 LeetCode - Medium - 106. Construct Binary Tree from Inorder and Postorder Traversal
TopicArrayTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder
2021-06-14 22:22:16
206
原创 LeetCode - Medium - 105. Construct Binary Tree from Preorder and Inorder Traversal
TopicArrayTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder i
2021-06-14 21:00:09
387
原创 LeetCode - Medium - 103. Binary Tree Zigzag Level Order Traversal
TopicStackTreeBreath-first SearchDescriptionhttps://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/Given the root of a binary tree, return the zigzag level order traversal of its nodes’ values. (i.e., from left to right, then right
2021-06-13 18:59:18
261
原创 LeetCode - Medium - 99. Recover Binary Search Tree
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/recover-binary-search-tree/You are given the root of a binary search tree (BST), where exactly two nodes of the tree were swapped by mistake. Recover the tree without changing its s
2021-06-13 13:54:56
256
原创 LeetCode - Medium - 98. Validate Binary Search Tree
TopicTreeRecursionDepth-first SearchDescriptionhttps://leetcode.com/problems/validate-binary-search-tree/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
2021-06-13 03:47:12
562
原创 LeetCode - Medium - 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
TopicTreeDepth-first SearchBreadth-first SearchRecursionDescriptionhttps://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/Given two binary trees original and cloned and given a reference to a node target i
2021-06-13 01:33:19
297
原创 LeetCode - Easy - 671. Second Minimum Node In a Binary Tree
TopicTreeDescriptionhttps://leetcode.com/problems/second-minimum-node-in-a-binary-tree/Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node h
2021-06-12 21:35:40
198
原创 LeetCode - Easy - 530. Minimum Absolute Difference in BST
TopicTreeDescriptionhttps://leetcode.com/problems/minimum-absolute-difference-in-bst/Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two different nodes in the tree.Example 1:Input: ro
2021-06-12 12:42:53
151
原创 LeetCode - Easy - 783. Minimum Distance Between BST Nodes
TopicTreeDepth-first SearchRecursionDescriptionhttps://leetcode.com/problems/minimum-distance-between-bst-nodes/Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree.E
2021-06-12 11:10:01
173
原创 LeetCode - Easy - 606. Construct String from Binary Tree
TopicStringTreeDescriptionhttps://leetcode.com/problems/construct-string-from-binary-tree/Given the root of a binary tree, construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way, and return it.Om
2021-06-12 02:40:54
190
原创 LeetCode - Medium - 95. Unique Binary Search Trees II
TopicDynamic ProgrammingTreeDescriptionhttps://leetcode.com/problems/unique-binary-search-trees-ii/Given an integer n, return all the structurally unique BST’s (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the
2021-06-12 01:34:54
187
原创 LeetCode - Easy - 872. Leaf-Similar Trees
TopicTreeDepth-first SearchDescriptionhttps://leetcode.com/problems/leaf-similar-trees/Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.For example, in the given tree above,
2021-06-11 23:55:05
189
原创 LeetCode - Easy - 965. Univalued Binary Tree
TopicTreeDescriptionhttps://leetcode.com/problems/univalued-binary-tree/A binary tree is univalued if every node in the tree has the same value.Return true if and only if the given tree is univalued.Example 1:Input: [1,1,1,1,1,null,1]Output: tru
2021-06-11 16:00:46
216
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅