mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-15 00:22:40 +08:00
8.0 KiB
8.0 KiB
title | type |
---|---|
Tree | docs |
Tree
No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity | Favorite | Acceptance |
---|---|---|---|---|---|---|---|
0094 | Binary Tree Inorder Traversal | [Go]({{< relref "/ChapterFour/0094.Binary-Tree-Inorder-Traversal.md" >}}) | Medium | O(n) | O(1) | 65.5% | |
0095 | Unique Binary Search Trees II | [Go]({{< relref "/ChapterFour/0095.Unique-Binary-Search-Trees-II.md" >}}) | Medium | 42.2% | |||
0096 | Unique Binary Search Trees | [Go]({{< relref "/ChapterFour/0096.Unique-Binary-Search-Trees.md" >}}) | Medium | O(n^2) | O(n) | 54.2% | |
0098 | Validate Binary Search Tree | [Go]({{< relref "/ChapterFour/0098.Validate-Binary-Search-Tree.md" >}}) | Medium | O(n) | O(1) | 28.6% | |
0099 | Recover Binary Search Tree | [Go]({{< relref "/ChapterFour/0099.Recover-Binary-Search-Tree.md" >}}) | Hard | O(n) | O(1) | 42.2% | |
0100 | Same Tree | [Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}}) | Easy | O(n) | O(1) | 54.0% | |
0101 | Symmetric Tree | [Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}}) | Easy | O(n) | O(1) | 47.9% | |
0102 | Binary Tree Level Order Traversal | [Go]({{< relref "/ChapterFour/0102.Binary-Tree-Level-Order-Traversal.md" >}}) | Medium | O(n) | O(1) | 56.3% | |
0103 | Binary Tree Zigzag Level Order Traversal | [Go]({{< relref "/ChapterFour/0103.Binary-Tree-Zigzag-Level-Order-Traversal.md" >}}) | Medium | O(n) | O(n) | 49.8% | |
0104 | Maximum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 67.8% | |
0105 | Construct Binary Tree from Preorder and Inorder Traversal | [Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}}) | Medium | 51.4% | |||
0106 | Construct Binary Tree from Inorder and Postorder Traversal | [Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}}) | Medium | 49.3% | |||
0107 | Binary Tree Level Order Traversal II | [Go]({{< relref "/ChapterFour/0107.Binary-Tree-Level-Order-Traversal-II.md" >}}) | Easy | O(n) | O(1) | 54.9% | |
0108 | Convert Sorted Array to Binary Search Tree | [Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}}) | Easy | O(n) | O(1) | 60.1% | |
0110 | Balanced Binary Tree | [Go]({{< relref "/ChapterFour/0110.Balanced-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 44.6% | |
0111 | Minimum Depth of Binary Tree | [Go]({{< relref "/ChapterFour/0111.Minimum-Depth-of-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 39.3% | |
0112 | Path Sum | [Go]({{< relref "/ChapterFour/0112.Path-Sum.md" >}}) | Easy | O(n) | O(1) | 42.2% | |
0113 | Path Sum II | [Go]({{< relref "/ChapterFour/0113.Path-Sum-II.md" >}}) | Medium | O(n) | O(1) | 48.7% | |
0114 | Flatten Binary Tree to Linked List | [Go]({{< relref "/ChapterFour/0114.Flatten-Binary-Tree-to-Linked-List.md" >}}) | Medium | O(n) | O(1) | 51.5% | |
0124 | Binary Tree Maximum Path Sum | [Go]({{< relref "/ChapterFour/0124.Binary-Tree-Maximum-Path-Sum.md" >}}) | Hard | O(n) | O(1) | 35.3% | |
0129 | Sum Root to Leaf Numbers | [Go]({{< relref "/ChapterFour/0129.Sum-Root-to-Leaf-Numbers.md" >}}) | Medium | O(n) | O(1) | 50.6% | |
0144 | Binary Tree Preorder Traversal | [Go]({{< relref "/ChapterFour/0144.Binary-Tree-Preorder-Traversal.md" >}}) | Medium | O(n) | O(1) | 57.2% | |
0145 | Binary Tree Postorder Traversal | [Go]({{< relref "/ChapterFour/0145.Binary-Tree-Postorder-Traversal.md" >}}) | Medium | O(n) | O(1) | 57.2% | |
0173 | Binary Search Tree Iterator | [Go]({{< relref "/ChapterFour/0173.Binary-Search-Tree-Iterator.md" >}}) | Medium | O(n) | O(1) | 59.7% | |
0199 | Binary Tree Right Side View | [Go]({{< relref "/ChapterFour/0199.Binary-Tree-Right-Side-View.md" >}}) | Medium | O(n) | O(1) | 55.8% | |
0222 | Count Complete Tree Nodes | [Go]({{< relref "/ChapterFour/0222.Count-Complete-Tree-Nodes.md" >}}) | Medium | O(n) | O(1) | 48.9% | |
0226 | Invert Binary Tree | [Go]({{< relref "/ChapterFour/0226.Invert-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 66.7% | |
0230 | Kth Smallest Element in a BST | [Go]({{< relref "/ChapterFour/0230.Kth-Smallest-Element-in-a-BST.md" >}}) | Medium | O(n) | O(1) | 62.2% | |
0235 | Lowest Common Ancestor of a Binary Search Tree | [Go]({{< relref "/ChapterFour/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md" >}}) | Easy | O(n) | O(1) | 51.5% | |
0236 | Lowest Common Ancestor of a Binary Tree | [Go]({{< relref "/ChapterFour/0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md" >}}) | Medium | O(n) | O(1) | 48.2% | |
0257 | Binary Tree Paths | [Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}}) | Easy | O(n) | O(1) | 53.3% | |
0337 | House Robber III | [Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}}) | Medium | 51.7% | |||
0404 | Sum of Left Leaves | [Go]({{< relref "/ChapterFour/0404.Sum-of-Left-Leaves.md" >}}) | Easy | O(n) | O(1) | 52.2% | |
0437 | Path Sum III | [Go]({{< relref "/ChapterFour/0437.Path-Sum-III.md" >}}) | Medium | O(n) | O(1) | 48.0% | |
0508 | Most Frequent Subtree Sum | [Go]({{< relref "/ChapterFour/0508.Most-Frequent-Subtree-Sum.md" >}}) | Medium | 58.9% | |||
0513 | Find Bottom Left Tree Value | [Go]({{< relref "/ChapterFour/0513.Find-Bottom-Left-Tree-Value.md" >}}) | Medium | 62.4% | |||
0515 | Find Largest Value in Each Tree Row | [Go]({{< relref "/ChapterFour/0515.Find-Largest-Value-in-Each-Tree-Row.md" >}}) | Medium | O(n) | O(n) | 62.1% | |
0563 | Binary Tree Tilt | [Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}}) | Easy | 52.7% | |||
0572 | Subtree of Another Tree | [Go]({{< relref "/ChapterFour/0572.Subtree-of-Another-Tree.md" >}}) | Easy | 44.5% | |||
0637 | Average of Levels in Binary Tree | [Go]({{< relref "/ChapterFour/0637.Average-of-Levels-in-Binary-Tree.md" >}}) | Easy | O(n) | O(n) | 64.6% | |
0653 | Two Sum IV - Input is a BST | [Go]({{< relref "/ChapterFour/0653.Two-Sum-IV---Input-is-a-BST.md" >}}) | Easy | 56.2% | |||
0662 | Maximum Width of Binary Tree | [Go]({{< relref "/ChapterFour/0662.Maximum-Width-of-Binary-Tree.md" >}}) | Medium | 40.0% | |||
0684 | Redundant Connection | [Go]({{< relref "/ChapterFour/0684.Redundant-Connection.md" >}}) | Medium | 58.8% | |||
0685 | Redundant Connection II | [Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}}) | Hard | 32.9% | |||
0834 | Sum of Distances in Tree | [Go]({{< relref "/ChapterFour/0834.Sum-of-Distances-in-Tree.md" >}}) | Hard | 45.6% | |||
0863 | All Nodes Distance K in Binary Tree | [Go]({{< relref "/ChapterFour/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}}) | Medium | 57.6% | |||
0872 | Leaf-Similar Trees | [Go]({{< relref "/ChapterFour/0872.Leaf-Similar-Trees.md" >}}) | Easy | 64.6% | |||
0897 | Increasing Order Search Tree | [Go]({{< relref "/ChapterFour/0897.Increasing-Order-Search-Tree.md" >}}) | Easy | 74.4% | |||
0968 | Binary Tree Cameras | [Go]({{< relref "/ChapterFour/0968.Binary-Tree-Cameras.md" >}}) | Hard | 38.5% | |||
0979 | Distribute Coins in Binary Tree | [Go]({{< relref "/ChapterFour/0979.Distribute-Coins-in-Binary-Tree.md" >}}) | Medium | 69.5% | |||
0993 | Cousins in Binary Tree | [Go]({{< relref "/ChapterFour/0993.Cousins-in-Binary-Tree.md" >}}) | Easy | O(n) | O(1) | 52.3% | |
1026 | Maximum Difference Between Node and Ancestor | [Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}}) | Medium | 69.2% | |||
1028 | Recover a Tree From Preorder Traversal | [Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}}) | Hard | 70.8% | |||
1110 | Delete Nodes And Return Forest | [Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}}) | Medium | 67.6% | |||
1123 | Lowest Common Ancestor of Deepest Leaves | [Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}}) | Medium | 67.9% | |||
1145 | Binary Tree Coloring Game | [Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}}) | Medium | 51.4% | |||
1302 | Deepest Leaves Sum | [Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}}) | Medium | 84.1% | |||
1305 | All Elements in Two Binary Search Trees | [Go]({{< relref "/ChapterFour/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}}) | Medium | 77.8% | |||
------------ | ------------------------------------------------------- | ------- | ---------------- | --------------- | ------------- | ------------- | ------------- |