![](https://img-blog.csdnimg.cn/20210817131913403.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
LeetCode
文章平均质量分 72
LeetCode汇总
巨輪
How many ten years are in left time?
展开
-
LeetCode - Medium - 213. House Robber II
LeetCode - Medium - 213. House Robber II原创 2022-12-09 22:55:56 · 1357 阅读 · 0 评论 -
LeetCode - Medium - 198. House Robber
LeetCode - Medium - 198. House Robber原创 2022-12-08 07:55:27 · 1067 阅读 · 0 评论 -
LeetCode - Medium - 343. Integer Break
LeetCode - Medium - 343. Integer Break原创 2022-12-08 05:51:53 · 1315 阅读 · 0 评论 -
LeetCode - Medium - 63. Unique Paths II
LeetCode - Medium - 63. Unique Paths II原创 2022-12-07 07:17:56 · 1375 阅读 · 0 评论 -
LeetCode - Medium - 62. Unique Paths
LeetCode - Medium - 62. Unique Paths原创 2022-12-07 05:31:00 · 1383 阅读 · 0 评论 -
LeetCode - Easy - 746. Min Cost Climbing Stairs
LeetCode - Easy - 746. Min Cost Climbing Stairs原创 2022-12-06 20:14:39 · 1715 阅读 · 0 评论 -
LeetCode - Easy - 509. Fibonacci Number
LeetCode - Easy - 509. Fibonacci Number原创 2022-12-06 06:02:32 · 1404 阅读 · 0 评论 -
LeetCode - Medium - 1261. Find Elements in a Contaminated Binary Tree
TopicTreeDepth-First SearchBreadth-First SearchDesignBinary TreeDescriptionhttps://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/Given a binary tree with the following rules:root.val == 0If treeNode.val == x and treeNode.le原创 2021-07-07 10:57:11 · 383 阅读 · 0 评论 -
LeetCode - Medium - 1325. Delete Leaves With a Given Value
TopicHash TableTreeBinary TreeDepth-First SearchBreadth-First SearchDescriptionhttps://leetcode.com/problems/delete-leaves-with-a-given-value/Given a binary tree root and an integer target, delete all the leaf nodes with value target.Note that o原创 2021-07-05 14:29:20 · 224 阅读 · 0 评论 -
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 · 212 阅读 · 0 评论 -
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 · 218 阅读 · 0 评论 -
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 · 192 阅读 · 0 评论 -
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 · 223 阅读 · 0 评论 -
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 · 198 阅读 · 0 评论 -
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 · 165 阅读 · 0 评论 -
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 · 185 阅读 · 0 评论 -
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 · 195 阅读 · 0 评论 -
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 · 200 阅读 · 0 评论 -
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 · 327 阅读 · 0 评论 -
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 · 167 阅读 · 0 评论 -
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 · 250 阅读 · 0 评论 -
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 · 227 阅读 · 0 评论 -
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 · 180 阅读 · 0 评论 -
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 · 175 阅读 · 0 评论 -
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 · 201 阅读 · 0 评论 -
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 · 217 阅读 · 0 评论 -
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 · 219 阅读 · 0 评论 -
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 · 195 阅读 · 0 评论 -
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 · 183 阅读 · 0 评论 -
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 · 378 阅读 · 0 评论 -
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 · 182 阅读 · 0 评论 -
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 · 186 阅读 · 0 评论 -
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 · 204 阅读 · 0 评论 -
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 · 187 阅读 · 0 评论 -
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 · 328 阅读 · 0 评论 -
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 · 218 阅读 · 0 评论 -
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 · 213 阅读 · 0 评论 -
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 · 525 阅读 · 0 评论 -
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 · 236 阅读 · 0 评论 -
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 · 156 阅读 · 0 评论