mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 09:23:19 +08:00
11 KiB
11 KiB
title | type | weight |
---|---|---|
2.06 Tree | docs | 6 |
Tree
No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity | Favorite | Acceptance |
---|---|---|---|---|---|---|---|
0094 | Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0001~0099/0094.Binary-Tree-Inorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 68.9% | |
0095 | Unique Binary Search Trees II | [Go]({{< relref "/ChapterFour/0001~0099/0095.Unique-Binary-Search-Trees-II.md" >}}) | Medium | 47.4% | |||
0096 | Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0001~0099/0096.Unique-Binary-Search-Trees.md" >}}) | Medium | O(n^2) | O(n) | 56.4% | |
0098 | Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0001~0099/0098.Validate-Binary-Search-Tree.md" >}}) | Medium | O(n) | O(1) | 29.8% | |
0099 | Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0001~0099/0099.Recover-Binary-Search-Tree.md" >}}) | Medium | O(n) | O(1) | 44.8% | |
0100 | Same Tree | [Go]({{< relref "/ChapterFour/0100~0199/0100.Same-Tree.md" >}}) | Easy | O(n) | O(1) | 54.9% | |
0101 | Symmetric Tree | [Go]({{< relref "/ChapterFour/0100~0199/0101.Symmetric-Tree.md" >}}) | Easy | O(n) | O(1) | 50.2% | |
0102 | Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0102.Binary-Tree-Level-Order-Traversal.md" >}}) | Medium | O(n) | O(1) | 59.2% | |
0103 | Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}}) | Medium | O(n) | O(n) | 52.1% | |
0104 | Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0100~0199/0104.Maximum-Depth-of-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 70.2% | |
0105 | Construct Binary Tree from Preorder and Inorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}}) | Medium | 55.5% | |||
0106 | Construct Binary Tree from Inorder and Postorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}}) | Medium | 52.7% | |||
0107 | Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0100~0199/0107.Binary-Tree-Level-Order-Traversal-II.md" >}}) | Medium | O(n) | O(1) | 57.2% | |
0108 | Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0100~0199/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}}) | Easy | O(n) | O(1) | 64.2% | |
0109 | Convert Sorted List to Binary Search Tree | [Go]({{< relref "/ChapterFour/0100~0199/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}}) | Medium | 53.9% | |||
0110 | Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0100~0199/0110.Balanced-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 45.8% | |
0111 | Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0100~0199/0111.Minimum-Depth-of-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 41.3% | |
0112 | Path Sum | [Go]({{< relref "/ChapterFour/0100~0199/0112.Path-Sum.md" >}}) | Easy | O(n) | O(1) | 44.1% | |
0113 | Path Sum II | [Go]({{< relref "/ChapterFour/0100~0199/0113.Path-Sum-II.md" >}}) | Medium | O(n) | O(1) | 52.4% | |
0114 | Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0100~0199/0114.Flatten-Binary-Tree-to-Linked-List.md" >}}) | Medium | O(n) | O(1) | 55.7% | |
0116 | Populating Next Right Pointers in Each Node | [Go]({{< relref "/ChapterFour/0100~0199/0116.Populating-Next-Right-Pointers-in-Each-Node.md" >}}) | Medium | 53.2% | |||
0124 | Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0100~0199/0124.Binary-Tree-Maximum-Path-Sum.md" >}}) | Hard | O(n) | O(1) | 36.8% | |
0129 | Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0100~0199/0129.Sum-Root-to-Leaf-Numbers.md" >}}) | Medium | O(n) | O(1) | 54.9% | |
0144 | Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0144.Binary-Tree-Preorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 60.3% | |
0145 | Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0100~0199/0145.Binary-Tree-Postorder-Traversal.md" >}}) | Easy | O(n) | O(1) | 61.3% | |
0173 | Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0100~0199/0173.Binary-Search-Tree-Iterator.md" >}}) | Medium | O(n) | O(1) | 63.4% | |
0199 | Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0100~0199/0199.Binary-Tree-Right-Side-View.md" >}}) | Medium | O(n) | O(1) | 58.2% | |
0222 | Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0200~0299/0222.Count-Complete-Tree-Nodes.md" >}}) | Medium | O(n) | O(1) | 53.4% | |
0226 | Invert Binary Tree | [Go]({{< relref "/ChapterFour/0200~0299/0226.Invert-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 69.9% | |
0230 | Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0200~0299/0230.Kth-Smallest-Element-in-a-BST.md" >}}) | Medium | O(n) | O(1) | 65.1% | |
0235 | Lowest Common Ancestor of a Binary Search Tree | [Go]({{< relref "/ChapterFour/0200~0299/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}}) | Easy | O(n) | O(1) | 55.0% | |
0236 | Lowest Common Ancestor of a Binary Tree | [Go]({{< relref "/ChapterFour/0200~0299/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}}) | Medium | O(n) | O(1) | 52.8% | |
0257 | Binary Tree Paths | [Go]({{< relref "/ChapterFour/0200~0299/0257.Binary-Tree-Paths.md" >}}) | Easy | O(n) | O(1) | 56.6% | |
0297 | Serialize and Deserialize Binary Tree | [Go]({{< relref "/ChapterFour/0200~0299/0297.Serialize-and-Deserialize-Binary-Tree.md" >}}) | Hard | 52.2% | |||
0331 | Verify Preorder Serialization of a Binary Tree | [Go]({{< relref "/ChapterFour/0300~0399/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}}) | Medium | 43.3% | |||
0337 | House Robber III | [Go]({{< relref "/ChapterFour/0300~0399/0337.House-Robber-III.md" >}}) | Medium | 52.5% | |||
0341 | Flatten Nested List Iterator | [Go]({{< relref "/ChapterFour/0300~0399/0341.Flatten-Nested-List-Iterator.md" >}}) | Medium | 57.5% | |||
0404 | Sum of Left Leaves | [Go]({{< relref "/ChapterFour/0400~0499/0404.Sum-of-Left-Leaves.md" >}}) | Easy | O(n) | O(1) | 54.2% | |
0429 | N-ary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0400~0499/0429.N-ary-Tree-Level-Order-Traversal.md" >}}) | Medium | 68.1% | |||
0437 | Path Sum III | [Go]({{< relref "/ChapterFour/0400~0499/0437.Path-Sum-III.md" >}}) | Medium | O(n) | O(1) | 49.6% | |
0508 | Most Frequent Subtree Sum | [Go]({{< relref "/ChapterFour/0500~0599/0508.Most-Frequent-Subtree-Sum.md" >}}) | Medium | 61.4% | |||
0513 | Find Bottom Left Tree Value | [Go]({{< relref "/ChapterFour/0500~0599/0513.Find-Bottom-Left-Tree-Value.md" >}}) | Medium | 64.1% | |||
0515 | Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0500~0599/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}}) | Medium | O(n) | O(n) | 63.7% | |
0530 | Minimum Absolute Difference in BST | [Go]({{< relref "/ChapterFour/0500~0599/0530.Minimum-Absolute-Difference-in-BST.md" >}}) | Easy | 55.7% | |||
0538 | Convert BST to Greater Tree | [Go]({{< relref "/ChapterFour/0500~0599/0538.Convert-BST-to-Greater-Tree.md" >}}) | Medium | 61.7% | |||
0543 | Diameter of Binary Tree | [Go]({{< relref "/ChapterFour/0500~0599/0543.Diameter-of-Binary-Tree.md" >}}) | Easy | 52.4% | |||
0563 | Binary Tree Tilt | [Go]({{< relref "/ChapterFour/0500~0599/0563.Binary-Tree-Tilt.md" >}}) | Easy | 54.8% | |||
0572 | Subtree of Another Tree | [Go]({{< relref "/ChapterFour/0500~0599/0572.Subtree-of-Another-Tree.md" >}}) | Easy | 44.9% | |||
0589 | N-ary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0500~0599/0589.N-ary-Tree-Preorder-Traversal.md" >}}) | Easy | 75.2% | |||
0617 | Merge Two Binary Trees | [Go]({{< relref "/ChapterFour/0600~0699/0617.Merge-Two-Binary-Trees.md" >}}) | Easy | 76.9% | |||
0623 | Add One Row to Tree | [Go]({{< relref "/ChapterFour/0600~0699/0623.Add-One-Row-to-Tree.md" >}}) | Medium | 53.5% | |||
0637 | Average of Levels in Binary Tree | [Go]({{< relref "/ChapterFour/0600~0699/0637.Average-of-Levels-in-Binary-Tree.md" >}}) | Easy | O(n) | O(n) | 67.4% | |
0653 | Two Sum IV - Input is a BST | [Go]({{< relref "/ChapterFour/0600~0699/0653.Two-Sum-IV-Input-is-a-BST.md" >}}) | Easy | 58.0% | |||
0662 | Maximum Width of Binary Tree | [Go]({{< relref "/ChapterFour/0600~0699/0662.Maximum-Width-of-Binary-Tree.md" >}}) | Medium | 39.6% | |||
0669 | Trim a Binary Search Tree | [Go]({{< relref "/ChapterFour/0600~0699/0669.Trim-a-Binary-Search-Tree.md" >}}) | Medium | 64.4% | |||
0703 | Kth Largest Element in a Stream | [Go]({{< relref "/ChapterFour/0700~0799/0703.Kth-Largest-Element-in-a-Stream.md" >}}) | Easy | 52.0% | |||
0783 | Minimum Distance Between BST Nodes | [Go]({{< relref "/ChapterFour/0700~0799/0783.Minimum-Distance-Between-BST-Nodes.md" >}}) | Easy | 55.3% | |||
0834 | Sum of Distances in Tree | [Go]({{< relref "/ChapterFour/0800~0899/0834.Sum-of-Distances-in-Tree.md" >}}) | Hard | 52.4% | |||
0863 | All Nodes Distance K in Binary Tree | [Go]({{< relref "/ChapterFour/0800~0899/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}}) | Medium | 59.8% | |||
0872 | Leaf-Similar Trees | [Go]({{< relref "/ChapterFour/0800~0899/0872.Leaf-Similar-Trees.md" >}}) | Easy | 64.7% | |||
0897 | Increasing Order Search Tree | [Go]({{< relref "/ChapterFour/0800~0899/0897.Increasing-Order-Search-Tree.md" >}}) | Easy | 75.6% | |||
0938 | Range Sum of BST | [Go]({{< relref "/ChapterFour/0900~0999/0938.Range-Sum-of-BST.md" >}}) | Easy | 84.0% | |||
0958 | Check Completeness of a Binary Tree | [Go]({{< relref "/ChapterFour/0900~0999/0958.Check-Completeness-of-a-Binary-Tree.md" >}}) | Medium | 52.9% | |||
0968 | Binary Tree Cameras | [Go]({{< relref "/ChapterFour/0900~0999/0968.Binary-Tree-Cameras.md" >}}) | Hard | 41.2% | |||
0971 | Flip Binary Tree To Match Preorder Traversal | [Go]({{< relref "/ChapterFour/0900~0999/0971.Flip-Binary-Tree-To-Match-Preorder-Traversal.md" >}}) | Medium | 49.8% | |||
0979 | Distribute Coins in Binary Tree | [Go]({{< relref "/ChapterFour/0900~0999/0979.Distribute-Coins-in-Binary-Tree.md" >}}) | Medium | 70.7% | |||
0987 | Vertical Order Traversal of a Binary Tree | [Go]({{< relref "/ChapterFour/0900~0999/0987.Vertical-Order-Traversal-of-a-Binary-Tree.md" >}}) | Hard | 39.9% | |||
0993 | Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0900~0999/0993.Cousins-in-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 53.6% | |
1026 | Maximum Difference Between Node and Ancestor | [Go]({{< relref "/ChapterFour/1000~1099/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}}) | Medium | 70.7% | |||
1028 | Recover a Tree From Preorder Traversal | [Go]({{< relref "/ChapterFour/1000~1099/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}}) | Hard | 71.8% | |||
1038 | Binary Search Tree to Greater Sum Tree | [Go]({{< relref "/ChapterFour/1000~1099/1038.Binary-Search-Tree-to-Greater-Sum-Tree.md" >}}) | Medium | 83.9% | |||
1104 | Path In Zigzag Labelled Binary Tree | [Go]({{< relref "/ChapterFour/1100~1199/1104.Path-In-Zigzag-Labelled-Binary-Tree.md" >}}) | Medium | 74.0% | |||
1110 | Delete Nodes And Return Forest | [Go]({{< relref "/ChapterFour/1100~1199/1110.Delete-Nodes-And-Return-Forest.md" >}}) | Medium | 68.8% | |||
1123 | Lowest Common Ancestor of Deepest Leaves | [Go]({{< relref "/ChapterFour/1100~1199/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}}) | Medium | 69.1% | |||
1145 | Binary Tree Coloring Game | [Go]({{< relref "/ChapterFour/1100~1199/1145.Binary-Tree-Coloring-Game.md" >}}) | Medium | 51.0% | |||
1302 | Deepest Leaves Sum | [Go]({{< relref "/ChapterFour/1300~1399/1302.Deepest-Leaves-Sum.md" >}}) | Medium | 85.6% | |||
1305 | All Elements in Two Binary Search Trees | [Go]({{< relref "/ChapterFour/1300~1399/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}}) | Medium | 78.5% | |||
1600 | Throne Inheritance | [Go]({{< relref "/ChapterFour/1600~1699/1600.Throne-Inheritance.md" >}}) | Medium | 62.2% | |||
------------ | ------------------------------------------------------- | ------- | ---------------- | --------------- | ------------- | ------------- | ------------- |