> ## Documentation Index
> Fetch the complete documentation index at: https://leetcode-py.wisl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.
> Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.
> Examples are backed by tests; copy them verbatim.

# Tree in Python with Tests

> All 149 Tree LeetCode problems with tested Python solutions.

Tree holds 149 problems (35 Easy, 101 Medium, 13 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 94 | [Binary Tree Inorder Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-inorder-traversal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_inorder_traversal/solution.py) |
| 95 | [Unique Binary Search Trees II](https://leetcode-py.wisl.dev/problems/unique-binary-search-trees-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_binary_search_trees_ii/solution.py) |
| 96 | [Unique Binary Search Trees](https://leetcode-py.wisl.dev/problems/unique-binary-search-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/unique_binary_search_trees/solution.py) |
| 98 | [Validate Binary Search Tree](https://leetcode-py.wisl.dev/problems/validate-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/validate_binary_search_tree/solution.py) |
| 99 | [Recover Binary Search Tree](https://leetcode-py.wisl.dev/problems/recover-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/recover_binary_search_tree/solution.py) |
| 100 | [Same Tree](https://leetcode-py.wisl.dev/problems/same-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/same_tree/solution.py) |
| 101 | [Symmetric Tree](https://leetcode-py.wisl.dev/problems/symmetric-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/symmetric_tree/solution.py) |
| 102 | [Binary Tree Level Order Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-level-order-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_level_order_traversal/solution.py) |
| 103 | [Binary Tree Zigzag Level Order Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-zigzag-level-order-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_zigzag_level_order_traversal/solution.py) |
| 104 | [Maximum Depth of Binary Tree](https://leetcode-py.wisl.dev/problems/maximum-depth-of-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_depth_of_binary_tree/solution.py) |
| 105 | [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode-py.wisl.dev/problems/construct-binary-tree-from-preorder-and-inorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_preorder_and_inorder_traversal/solution.py) |
| 106 | [Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode-py.wisl.dev/problems/construct-binary-tree-from-inorder-and-postorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_inorder_and_postorder_traversal/solution.py) |
| 107 | [Binary Tree Level Order Traversal II](https://leetcode-py.wisl.dev/problems/binary-tree-level-order-traversal-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_level_order_traversal_ii/solution.py) |
| 108 | [Convert Sorted Array to Binary Search Tree](https://leetcode-py.wisl.dev/problems/convert-sorted-array-to-binary-search-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_sorted_array_to_binary_search_tree/solution.py) |
| 109 | [Convert Sorted List to Binary Search Tree](https://leetcode-py.wisl.dev/problems/convert-sorted-list-to-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_sorted_list_to_binary_search_tree/solution.py) |
| 110 | [Balanced Binary Tree](https://leetcode-py.wisl.dev/problems/balanced-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/balanced_binary_tree/solution.py) |
| 111 | [Minimum Depth of Binary Tree](https://leetcode-py.wisl.dev/problems/minimum-depth-of-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_depth_of_binary_tree/solution.py) |
| 112 | [Path Sum](https://leetcode-py.wisl.dev/problems/path-sum) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/path_sum/solution.py) |
| 113 | [Path Sum II](https://leetcode-py.wisl.dev/problems/path-sum-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/path_sum_ii/solution.py) |
| 114 | [Flatten Binary Tree to Linked List](https://leetcode-py.wisl.dev/problems/flatten-binary-tree-to-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_binary_tree_to_linked_list/solution.py) |
| 116 | [Populating Next Right Pointers In Each Node](https://leetcode-py.wisl.dev/problems/populating-next-right-pointers-in-each-node) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/populating_next_right_pointers_in_each_node/solution.py) |
| 117 | [Populating Next Right Pointers in Each Node II](https://leetcode-py.wisl.dev/problems/populating-next-right-pointers-in-each-node-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/populating_next_right_pointers_in_each_node_ii/solution.py) |
| 124 | [Binary Tree Maximum Path Sum](https://leetcode-py.wisl.dev/problems/binary-tree-maximum-path-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_maximum_path_sum/solution.py) |
| 129 | [Sum Root to Leaf Numbers](https://leetcode-py.wisl.dev/problems/sum-root-to-leaf-numbers) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_root_to_leaf_numbers/solution.py) |
| 144 | [Binary Tree Preorder Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-preorder-traversal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_preorder_traversal/solution.py) |
| 145 | [Binary Tree Postorder Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-postorder-traversal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_postorder_traversal/solution.py) |
| 156 | [Binary Tree Upside Down](https://leetcode-py.wisl.dev/problems/binary-tree-upside-down) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_upside_down/solution.py) |
| 173 | [Binary Search Tree Iterator](https://leetcode-py.wisl.dev/problems/binary-search-tree-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_search_tree_iterator/solution.py) |
| 199 | [Binary Tree Right Side View](https://leetcode-py.wisl.dev/problems/binary-tree-right-side-view) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_right_side_view/solution.py) |
| 222 | [Count Complete Tree Nodes](https://leetcode-py.wisl.dev/problems/count-complete-tree-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_complete_tree_nodes/solution.py) |
| 226 | [Invert Binary Tree](https://leetcode-py.wisl.dev/problems/invert-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/invert_binary_tree/solution.py) |
| 230 | [Kth Smallest Element in a BST](https://leetcode-py.wisl.dev/problems/kth-smallest-element-in-a-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_smallest_element_in_a_bst/solution.py) |
| 235 | [Lowest Common Ancestor of a Binary Search Tree](https://leetcode-py.wisl.dev/problems/lowest-common-ancestor-of-a-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lowest_common_ancestor_of_a_binary_search_tree/solution.py) |
| 236 | [Lowest Common Ancestor of a Binary Tree](https://leetcode-py.wisl.dev/problems/lowest-common-ancestor-of-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lowest_common_ancestor_of_a_binary_tree/solution.py) |
| 250 | [Count Univalue Subtrees](https://leetcode-py.wisl.dev/problems/count-univalue-subtrees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_univalue_subtrees/solution.py) |
| 255 | [Verify Preorder Sequence in Binary Search Tree](https://leetcode-py.wisl.dev/problems/verify-preorder-sequence-in-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/verify_preorder_sequence_in_binary_search_tree/solution.py) |
| 257 | [Binary Tree Paths](https://leetcode-py.wisl.dev/problems/binary-tree-paths) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_paths/solution.py) |
| 270 | [Closest Binary Search Tree Value](https://leetcode-py.wisl.dev/problems/closest-bst-value) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/closest_bst_value/solution.py) |
| 272 | [Closest Binary Search Tree Value II](https://leetcode-py.wisl.dev/problems/closest-bst-value-ii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/closest_bst_value_ii/solution.py) |
| 285 | [Inorder Successor in BST](https://leetcode-py.wisl.dev/problems/inorder-successor-in-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/inorder_successor_in_bst/solution.py) |
| 297 | [Serialize and Deserialize Binary Tree](https://leetcode-py.wisl.dev/problems/serialize-and-deserialize-binary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/serialize_and_deserialize_binary_tree/solution.py) |
| 298 | [Binary Tree Longest Consecutive Sequence](https://leetcode-py.wisl.dev/problems/binary-tree-longest-consecutive-sequence) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_longest_consecutive_sequence/solution.py) |
| 314 | [Binary Tree Vertical Order Traversal](https://leetcode-py.wisl.dev/problems/binary-tree-vertical-order-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_vertical_order_traversal/solution.py) |
| 331 | [Verify Preorder Serialization of a Binary Tree](https://leetcode-py.wisl.dev/problems/verify-preorder-serialization-of-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/verify_preorder_serialization_of_a_binary_tree/solution.py) |
| 333 | [Largest BST Subtree](https://leetcode-py.wisl.dev/problems/largest-bst-subtree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/largest_bst_subtree/solution.py) |
| 337 | [House Robber III](https://leetcode-py.wisl.dev/problems/house-robber-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/house_robber_iii/solution.py) |
| 341 | [Flatten Nested List Iterator](https://leetcode-py.wisl.dev/problems/flatten-nested-list-iterator) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flatten_nested_list_iterator/solution.py) |
| 366 | [Find Leaves of Binary Tree](https://leetcode-py.wisl.dev/problems/find-leaves-of-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_leaves_of_binary_tree/solution.py) |
| 404 | [Sum of Left Leaves](https://leetcode-py.wisl.dev/problems/sum-of-left-leaves) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_left_leaves/solution.py) |
| 426 | [Convert Binary Search Tree to Sorted Doubly Linked List](https://leetcode-py.wisl.dev/problems/convert-binary-search-tree-to-sorted-doubly-linked-list) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_binary_search_tree_to_sorted_doubly_linked_list/solution.py) |
| 427 | [Construct Quad Tree](https://leetcode-py.wisl.dev/problems/construct-quad-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_quad_tree/solution.py) |
| 428 | [Serialize and Deserialize N-ary Tree](https://leetcode-py.wisl.dev/problems/serialize-and-deserialize-n-ary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/serialize_and_deserialize_n_ary_tree/solution.py) |
| 429 | [N-ary Tree Level Order Traversal](https://leetcode-py.wisl.dev/problems/n-ary-tree-level-order-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/n_ary_tree_level_order_traversal/solution.py) |
| 431 | [Encode N-ary Tree to Binary Tree](https://leetcode-py.wisl.dev/problems/encode-n-ary-tree-to-binary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/encode_n_ary_tree_to_binary_tree/solution.py) |
| 437 | [Path Sum III](https://leetcode-py.wisl.dev/problems/path-sum-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/path_sum_iii/solution.py) |
| 449 | [Serialize and Deserialize BST](https://leetcode-py.wisl.dev/problems/serialize-and-deserialize-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/serialize_and_deserialize_bst/solution.py) |
| 450 | [Delete Node in a BST](https://leetcode-py.wisl.dev/problems/delete-node-in-a-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_node_in_a_bst/solution.py) |
| 501 | [Find Mode in Binary Search Tree](https://leetcode-py.wisl.dev/problems/find-mode-in-binary-search-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_mode_in_binary_search_tree/solution.py) |
| 508 | [Most Frequent Subtree Sum](https://leetcode-py.wisl.dev/problems/most-frequent-subtree-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/most_frequent_subtree_sum/solution.py) |
| 510 | [Inorder Successor in BST II](https://leetcode-py.wisl.dev/problems/inorder-successor-in-bst-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/inorder_successor_in_bst_ii/solution.py) |
| 513 | [Find Bottom Left Tree Value](https://leetcode-py.wisl.dev/problems/find-bottom-left-tree-value) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_bottom_left_tree_value/solution.py) |
| 515 | [Find Largest Value in Each Tree Row](https://leetcode-py.wisl.dev/problems/find-largest-value-in-each-tree-row) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_largest_value_in_each_tree_row/solution.py) |
| 530 | [Minimum Absolute Difference in BST](https://leetcode-py.wisl.dev/problems/minimum-absolute-difference-in-bst) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_absolute_difference_in_bst/solution.py) |
| 536 | [Construct Binary Tree from String](https://leetcode-py.wisl.dev/problems/construct-binary-tree-from-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_string/solution.py) |
| 538 | [Convert BST to Greater Tree](https://leetcode-py.wisl.dev/problems/convert-bst-to-greater-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/convert_bst_to_greater_tree/solution.py) |
| 543 | [Diameter of Binary Tree](https://leetcode-py.wisl.dev/problems/diameter-of-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/diameter_of_binary_tree/solution.py) |
| 545 | [Boundary of Binary Tree](https://leetcode-py.wisl.dev/problems/boundary-of-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/boundary_of_binary_tree/solution.py) |
| 549 | [Binary Tree Longest Consecutive Sequence II](https://leetcode-py.wisl.dev/problems/binary-tree-longest-consecutive-sequence-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_longest_consecutive_sequence_ii/solution.py) |
| 558 | [Logical OR of Two Binary Grids Represented as Quad-Trees](https://leetcode-py.wisl.dev/problems/logical-or-of-two-binary-grids-represented-as-quad-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/logical_or_of_two_binary_grids_represented_as_quad_trees/solution.py) |
| 559 | [Maximum Depth of N-ary Tree](https://leetcode-py.wisl.dev/problems/maximum-depth-of-n-ary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_depth_of_n_ary_tree/solution.py) |
| 563 | [Binary Tree Tilt](https://leetcode-py.wisl.dev/problems/binary-tree-tilt) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_tilt/solution.py) |
| 572 | [Subtree of Another Tree](https://leetcode-py.wisl.dev/problems/subtree-of-another-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subtree_of_another_tree/solution.py) |
| 582 | [Kill Process](https://leetcode-py.wisl.dev/problems/kill-process) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kill_process/solution.py) |
| 589 | [N-ary Tree Preorder Traversal](https://leetcode-py.wisl.dev/problems/n-ary-tree-preorder-traversal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/n_ary_tree_preorder_traversal/solution.py) |
| 590 | [N-ary Tree Postorder Traversal](https://leetcode-py.wisl.dev/problems/n-ary-tree-postorder-traversal) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/n_ary_tree_postorder_traversal/solution.py) |
| 606 | [Construct String from Binary Tree](https://leetcode-py.wisl.dev/problems/construct-string-from-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_string_from_binary_tree/solution.py) |
| 617 | [Merge Two Binary Trees](https://leetcode-py.wisl.dev/problems/merge-two-binary-trees) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/merge_two_binary_trees/solution.py) |
| 623 | [Add One Row to Tree](https://leetcode-py.wisl.dev/problems/add-one-row-to-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/add_one_row_to_tree/solution.py) |
| 637 | [Average of Levels in Binary Tree](https://leetcode-py.wisl.dev/problems/average-of-levels-in-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/average_of_levels_in_binary_tree/solution.py) |
| 652 | [Find Duplicate Subtrees](https://leetcode-py.wisl.dev/problems/find-duplicate-subtrees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_duplicate_subtrees/solution.py) |
| 653 | [Two Sum IV - Input is a BST](https://leetcode-py.wisl.dev/problems/two-sum-iv-input-is-a-bst) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/two_sum_iv_input_is_a_bst/solution.py) |
| 654 | [Maximum Binary Tree](https://leetcode-py.wisl.dev/problems/maximum-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_binary_tree/solution.py) |
| 655 | [Print Binary Tree](https://leetcode-py.wisl.dev/problems/print-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/print_binary_tree/solution.py) |
| 662 | [Maximum Width of Binary Tree](https://leetcode-py.wisl.dev/problems/maximum-width-of-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_width_of_binary_tree/solution.py) |
| 663 | [Equal Tree Partition](https://leetcode-py.wisl.dev/problems/equal-tree-partition) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/equal_tree_partition/solution.py) |
| 666 | [Path Sum IV](https://leetcode-py.wisl.dev/problems/path-sum-iv) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/path_sum_iv/solution.py) |
| 669 | [Trim a Binary Search Tree](https://leetcode-py.wisl.dev/problems/trim-a-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/trim_a_binary_search_tree/solution.py) |
| 671 | [Second Minimum Node In a Binary Tree](https://leetcode-py.wisl.dev/problems/second-minimum-node-in-a-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/second_minimum_node_in_a_binary_tree/solution.py) |
| 687 | [Longest Univalue Path](https://leetcode-py.wisl.dev/problems/longest-univalue-path) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_univalue_path/solution.py) |
| 690 | [Employee Importance](https://leetcode-py.wisl.dev/problems/employee-importance) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/employee_importance/solution.py) |
| 700 | [Search in a Binary Search Tree](https://leetcode-py.wisl.dev/problems/search-in-a-binary-search-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/search_in_a_binary_search_tree/solution.py) |
| 701 | [Insert into a Binary Search Tree](https://leetcode-py.wisl.dev/problems/insert-into-a-binary-search-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/insert_into_a_binary_search_tree/solution.py) |
| 703 | [Kth Largest Element in a Stream](https://leetcode-py.wisl.dev/problems/kth-largest-element-in-a-stream) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_largest_element_in_a_stream/solution.py) |
| 742 | [Closest Leaf in a Binary Tree](https://leetcode-py.wisl.dev/problems/closest-leaf-in-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/closest_leaf_in_a_binary_tree/solution.py) |
| 776 | [Split BST](https://leetcode-py.wisl.dev/problems/split-bst) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/split_bst/solution.py) |
| 783 | [Minimum Distance Between BST Nodes](https://leetcode-py.wisl.dev/problems/min-distance-in-bst) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/min_distance_in_bst/solution.py) |
| 814 | [Binary Tree Pruning](https://leetcode-py.wisl.dev/problems/binary-tree-pruning) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_pruning/solution.py) |
| 834 | [Sum of Distances in Tree](https://leetcode-py.wisl.dev/problems/sum-of-distances-in-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sum_of_distances_in_tree/solution.py) |
| 863 | [All Nodes Distance K in Binary Tree](https://leetcode-py.wisl.dev/problems/all-nodes-distance-k-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/all_nodes_distance_k_in_binary_tree/solution.py) |
| 865 | [Smallest Subtree with all the Deepest Nodes](https://leetcode-py.wisl.dev/problems/smallest-subtree-with-all-the-deepest-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/smallest_subtree_with_all_the_deepest_nodes/solution.py) |
| 872 | [Leaf-Similar Trees](https://leetcode-py.wisl.dev/problems/leaf-similar-trees) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/leaf_similar_trees/solution.py) |
| 889 | [Construct Binary Tree from Preorder and Postorder Traversal](https://leetcode-py.wisl.dev/problems/construct-binary-tree-from-preorder-and-postorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/construct_binary_tree_from_preorder_and_postorder_traversal/solution.py) |
| 894 | [All Possible Full Binary Trees](https://leetcode-py.wisl.dev/problems/all-possible-full-binary-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/all_possible_full_binary_trees/solution.py) |
| 897 | [Increasing Order Search Tree](https://leetcode-py.wisl.dev/problems/increasing-order-search-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/increasing_order_search_tree/solution.py) |
| 919 | [Complete Binary Tree Inserter](https://leetcode-py.wisl.dev/problems/complete-binary-tree-inserter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/complete_binary_tree_inserter/solution.py) |
| 938 | [Range Sum of BST](https://leetcode-py.wisl.dev/problems/range-sum-of-bst) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/range_sum_of_bst/solution.py) |
| 951 | [Flip Equivalent Binary Trees](https://leetcode-py.wisl.dev/problems/flip-equivalent-binary-trees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flip_equivalent_binary_trees/solution.py) |
| 958 | [Check Completeness of a Binary Tree](https://leetcode-py.wisl.dev/problems/check-completeness-of-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/check_completeness_of_a_binary_tree/solution.py) |
| 965 | [Univalued Binary Tree](https://leetcode-py.wisl.dev/problems/univalued-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/univalued_binary_tree/solution.py) |
| 968 | [Binary Tree Cameras](https://leetcode-py.wisl.dev/problems/binary-tree-cameras) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_tree_cameras/solution.py) |
| 971 | [Flip Binary Tree To Match Preorder Traversal](https://leetcode-py.wisl.dev/problems/flip-binary-tree-to-match-preorder-traversal) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/flip_binary_tree_to_match_preorder_traversal/solution.py) |
| 979 | [Distribute Coins in Binary Tree](https://leetcode-py.wisl.dev/problems/distribute-coins-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/distribute_coins_in_binary_tree/solution.py) |
| 987 | [Vertical Order Traversal of a Binary Tree](https://leetcode-py.wisl.dev/problems/vertical-order-traversal-of-a-binary-tree) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/vertical_order_traversal_of_a_binary_tree/solution.py) |
| 988 | [Smallest String Starting From Leaf](https://leetcode-py.wisl.dev/problems/smallest-string-starting-from-leaf) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/smallest_string_starting_from_leaf/solution.py) |
| 993 | [Cousins in Binary Tree](https://leetcode-py.wisl.dev/problems/cousins-in-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cousins_in_binary_tree/solution.py) |
| 998 | [Maximum Binary Tree II](https://leetcode-py.wisl.dev/problems/maximum-binary-tree-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_binary_tree_ii/solution.py) |
| 1028 | [Recover a Tree From Preorder Traversal](https://leetcode-py.wisl.dev/problems/recover-a-tree-from-preorder-traversal) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/recover_a_tree_from_preorder_traversal/solution.py) |
| 1110 | [Delete Nodes And Return Forest](https://leetcode-py.wisl.dev/problems/delete-nodes-and-return-forest) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_nodes_and_return_forest/solution.py) |
| 1120 | [Maximum Average Subtree](https://leetcode-py.wisl.dev/problems/maximum-average-subtree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_average_subtree/solution.py) |
| 1214 | [Two Sum BSTs](https://leetcode-py.wisl.dev/problems/two-sum-bsts) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/two_sum_bsts/solution.py) |
| 1245 | [Tree Diameter](https://leetcode-py.wisl.dev/problems/tree-diameter) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/tree_diameter/solution.py) |
| 1273 | [Delete Tree Nodes](https://leetcode-py.wisl.dev/problems/delete-tree-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_tree_nodes/solution.py) |
| 1325 | [Delete Leaves With a Given Value](https://leetcode-py.wisl.dev/problems/delete-leaves-with-a-given-value) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/delete_leaves_with_a_given_value/solution.py) |
| 1361 | [Validate Binary Tree Nodes](https://leetcode-py.wisl.dev/problems/validate-binary-tree-nodes) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/validate_binary_tree_nodes/solution.py) |
| 1367 | [Linked List in Binary Tree](https://leetcode-py.wisl.dev/problems/linked-list-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/linked_list_in_binary_tree/solution.py) |
| 1376 | [Time Needed to Inform All Employees](https://leetcode-py.wisl.dev/problems/time-needed-to-inform-all-employees) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/time_needed_to_inform_all_employees/solution.py) |
| 1443 | [Minimum Time to Collect All Apples in a Tree](https://leetcode-py.wisl.dev/problems/minimum-time-to-collect-all-apples-in-a-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_time_to_collect_all_apples_in_a_tree/solution.py) |
| 1448 | [Count Good Nodes in Binary Tree](https://leetcode-py.wisl.dev/problems/count-good-nodes-in-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_good_nodes_in_binary_tree/solution.py) |
| 1457 | [Pseudo-Palindromic Paths in a Binary Tree](https://leetcode-py.wisl.dev/problems/pseudo-palindromic-paths-in-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/pseudo_palindromic_paths_in_a_binary_tree/solution.py) |
| 1490 | [Clone N-ary Tree](https://leetcode-py.wisl.dev/problems/clone-n-ary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/clone_n_ary_tree/solution.py) |
| 1506 | [Find Root of N-Ary Tree](https://leetcode-py.wisl.dev/problems/find-root-of-n-ary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_root_of_n_ary_tree/solution.py) |
| 1522 | [Diameter of N-Ary Tree](https://leetcode-py.wisl.dev/problems/diameter-of-n-ary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/diameter_of_n_ary_tree/solution.py) |
| 1530 | [Number of Good Leaf Nodes Pairs](https://leetcode-py.wisl.dev/problems/number-of-good-leaf-nodes-pairs) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_good_leaf_nodes_pairs/solution.py) |
| 1609 | [Even Odd Tree](https://leetcode-py.wisl.dev/problems/even-odd-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/even_odd_tree/solution.py) |
| 1650 | [Lowest Common Ancestor of a Binary Tree III](https://leetcode-py.wisl.dev/problems/lowest-common-ancestor-of-a-binary-tree-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/lowest_common_ancestor_of_a_binary_tree_iii/solution.py) |
| 1993 | [Operations on Tree](https://leetcode-py.wisl.dev/problems/operations-on-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/operations_on_tree/solution.py) |
| 2096 | [Step-By-Step Directions From a Binary Tree Node to Another](https://leetcode-py.wisl.dev/problems/step-by-step-directions-from-a-binary-tree-node-to-another) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/step_by_step_directions_from_a_binary_tree_node_to_another/solution.py) |
| 2196 | [Create Binary Tree From Descriptions](https://leetcode-py.wisl.dev/problems/create-binary-tree-from-descriptions) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/create_binary_tree_from_descriptions/solution.py) |
| 2331 | [Evaluate Boolean Binary Tree](https://leetcode-py.wisl.dev/problems/evaluate-boolean-binary-tree) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/evaluate_boolean_binary_tree/solution.py) |
| 2415 | [Reverse Odd Levels of Binary Tree](https://leetcode-py.wisl.dev/problems/reverse-odd-levels-of-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/reverse_odd_levels_of_binary_tree/solution.py) |
| 2421 | [Number of Good Paths](https://leetcode-py.wisl.dev/problems/number-of-good-paths) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_good_paths/solution.py) |
| 2467 | [Most Profitable Path in a Tree](https://leetcode-py.wisl.dev/problems/most-profitable-path-in-a-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/most_profitable_path_in_a_tree/solution.py) |
| 2471 | [Minimum Number of Operations to Sort a Binary Tree by Level](https://leetcode-py.wisl.dev/problems/minimum-operations-to-sort-a-binary-tree-by-level) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_operations_to_sort_a_binary_tree_by_level/solution.py) |
| 2477 | [Minimum Fuel Cost to Report to the Capital](https://leetcode-py.wisl.dev/problems/minimum-fuel-cost-to-report-to-the-capital) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_fuel_cost_to_report_to_the_capital/solution.py) |
| 2583 | [Kth Largest Sum in a Binary Tree](https://leetcode-py.wisl.dev/problems/kth-largest-sum-in-a-binary-tree) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/kth_largest_sum_in_a_binary_tree/solution.py) |
| 2641 | [Cousins in Binary Tree II](https://leetcode-py.wisl.dev/problems/cousins-in-binary-tree-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/cousins_in_binary_tree_ii/solution.py) |
| 2872 | [Maximum Number of K-Divisible Components](https://leetcode-py.wisl.dev/problems/maximum-number-of-k-divisible-components) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_number_of_k_divisible_components/solution.py) |
| 3068 | [Find the Maximum Sum of Node Values](https://leetcode-py.wisl.dev/problems/find-the-maximum-sum-of-node-values) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_maximum_sum_of_node_values/solution.py) |
| 3203 | [Find Minimum Diameter After Merging Two Trees](https://leetcode-py.wisl.dev/problems/find-minimum-diameter-after-merging-two-trees) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_minimum_diameter_after_merging_two_trees/solution.py) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.