Skip to content

Commit 94e3c9c

Browse files
committed
remove problem 872 from the list of tree problems
1 parent b8b1e02 commit 94e3c9c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Two great online resources have been leveraged to compile the list:
2121
| 04 | [Binary Search Tree](#binary-search-tree) | 14 |
2222
| 05 | [Stack and Queue](#stack-and-queue) | 11 |
2323
| 06 | [Hash table and set](#hash-table-and-set) | 6 |
24-
| 07 | [Tree](#tree) | 37 |
24+
| 07 | [Tree](#tree) | 36 |
2525
| 08 | [Divide and Conquer](#divide-and-conquer) | 6 |
2626
| 09 | [Graph](#graph) | 25 |
2727
| 10 | [Greedy Algorithm](#greedy-algorithm) | 10 |
2828
| 11 | [Backtracking](#backtracking) | 22 |
2929
| 12 | [Dynamic Programming](#dynamic-programming) | 30 |
3030
| 13 | [Miscellaneous (string, array, math, bit manipulation)](#miscellaneous) | 35 |
3131
| 14 | [Advanced Topics (Trie, Topological sorting, Union find)](#advanced-topics) | 14 |
32-
| | | 258 (total) |
32+
| | | 257 (total) |
3333

3434
* [Time and Space Complexity of Algorithms](#complexity-of-an-algorithm-chart_with_upwards_trend)
3535
* [How to Approach a Coding Question](#how-to-approach-a-coding-question-heavy_check_mark)
@@ -156,7 +156,7 @@ space, where `w` is the maximum width of a tree. Moreover, it is very important
156156
[437](https://leetcode.com/problems/path-sum-iii/) | Path Sum III | Easy/Medium | [113](https://leetcode.com/problems/path-sum-ii/), [129](https://leetcode.com/problems/sum-root-to-leaf-numbers/), [257](https://leetcode.com/problems/binary-tree-paths/) | For Problem 437, use hash_table + DFS to achieve linear time complexity, similar to two sum problem. Check out similar problem [560](https://leetcode.com/problems/subarray-sum-equals-k/).
157157
[124](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | Binary Tree Maximum Path Sum | Hard/Medium | [543](https://leetcode.com/problems/diameter-of-binary-tree/) | Find left sum and right sum, and use both of them to calculate the sum with the current node as the root, and return only one of them.
158158
[572](https://leetcode.com/problems/subtree-of-another-tree/) | Subtree of Another Tree | Easy/Medium | [687](https://leetcode.com/problems/longest-univalue-path/) | Recursively check if `t` is the same tree with a tree rooted at the current node, or if `t` is a subtree rooted at current node's left or right child. Problem 687 can have linear time complexity by calculating the longest path by using left and right paths and only returning the max of left and right paths.
159-
[102](https://leetcode.com/problems/binary-tree-level-order-traversal/) | Binary Tree Level Order Traversal | Medium | [637](https://leetcode.com/problems/average-of-levels-in-binary-tree/), [513](https://leetcode.com/problems/find-bottom-left-tree-value/), [429](https://leetcode.com/problems/n-ary-tree-level-order-traversal/), [1302](https://leetcode.com/problems/deepest-leaves-sum/), [872](https://leetcode.com/problems/leaf-similar-trees/) | Level-order traversal. Use BFS or `defaultdict[list]` to add node into corresponding level.
159+
[102](https://leetcode.com/problems/binary-tree-level-order-traversal/) | Binary Tree Level Order Traversal | Medium | [637](https://leetcode.com/problems/average-of-levels-in-binary-tree/), [513](https://leetcode.com/problems/find-bottom-left-tree-value/), [429](https://leetcode.com/problems/n-ary-tree-level-order-traversal/), [1302](https://leetcode.com/problems/deepest-leaves-sum/) | Level-order traversal. Use BFS or `defaultdict[list]` to add node into corresponding level.
160160
[144](https://leetcode.com/problems/binary-tree-preorder-traversal/) | Binary Tree Preorder Traversal | Medium | [589](https://leetcode.com/problems/n-ary-tree-preorder-traversal/), [145](https://leetcode.com/problems/binary-tree-postorder-traversal/), [590](https://leetcode.com/problems/n-ary-tree-postorder-traversal/), [94](https://leetcode.com/problems/binary-tree-inorder-traversal/) | Recursively is trivial, but iteratively is very complicated. IMO, iteratively in-order traversal is the hardest.
161161
[297](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) | Serialize and Deserialize Binary Tree | Hard | [449](https://leetcode.com/problems/serialize-and-deserialize-bst/), [1008](https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/), [106](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/), [105](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | In the binary tree problem, we need to have "null" indicator to represent null node in the serialized string, while BST does not. BST problem uses pre-order traversal to serialize and deserialize by recursively building trees by checking lower and upper bounds for subtrees.
162162
[968](https://leetcode.com/problems/binary-tree-cameras/) | Binary Tree Cameras | Hard | [979](https://leetcode.com/problems/distribute-coins-in-binary-tree/) | Bottom up. DFS + greedy.

0 commit comments

Comments
 (0)