An open API service indexing awesome lists of open source software.

https://github.com/clintjohnsn/ds-algo

Leetcode solutions in python, with time and complexity analysis and documentation.
https://github.com/clintjohnsn/ds-algo

algorithms data-structures leetcode leetcode-python leetcode-python3 leetcode-solutions

Last synced: 4 months ago
JSON representation

Leetcode solutions in python, with time and complexity analysis and documentation.

Awesome Lists containing this project

README

        

# Leetcode Solutions

Regularly updated Leetcode solutions in python. Multiple approaches and solutions for every problem, along with time and space complexity analysis and comments. Focus on data structures and algorithms.

### Problem List

| No | Problem | Source | Difficulty | Solution | Topic |
| --- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ---------- | ---------------------------------------------------------------------------------- | ------------------- |
| 1 | [Count and Say](https://leetcode.com/problems/count-and-say/description/) | LeetCode #38 | easy | [solution](./arrays/easy/count_and_say.py) | Arrays |
| 2 | [Power(x,n)](https://leetcode.com/problems/powx-n/description/) | LeetCode #50 | easy | [solution](./warmup/power.py) | Arrays |
| 3 | [Two Sum](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/) | LeetCode #167 | easy | [solution](./arrays/easy/2sum.py) | Arrays |
| 4 | [Group Anagrams](https://leetcode.com/problems/group-anagrams/description/) | LeetCode #49 | easy | [solution](./arrays/easy/anagrams2.py) | Arrays |
| 5 | [Remove Duplicates](https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/) | LeetCode #26 | easy | [solution](./arrays/easy/remove_duplicates.py) | Arrays |
| 6 | [Pivot element/Equilibrium element](https://leetcode.com/problems/find-pivot-index/description/) | LeetCode #724 | easy | [solution](./arrays/easy/equilibrium.py) | Arrays |
| 7 | [Array Intersection](https://leetcode.com/problems/intersection-of-two-arrays/description/) | LeetCode 349 | easy | [solution](./arrays/easy/intersection.py) | Arrays |
| 8 | [Last stone weight](https://leetcode.com/problems/last-stone-weight/) | LeetCode #1046 | easy | [solution](./arrays/easy/last_stone_weight.py) | Arrays |
| 9 | [Majority Element](https://leetcode.com/problems/majority-element/description/) | Leetcode #169 | easy | [solution](./arrays/easy/majority_element.py) | Arrays |
| 10 | [Best time to buy and sell stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | Leetcode #121 | easy | [solution](./arrays/easy/stock_buy_sell.py) | Arrays |
| 11 | [Remove Duplicates](https://leetcode.com/problems/remove-duplicates-from-sorted-array/) | Leetcode #26 | easy | [solution](./arrays/easy/remove_duplicates.py) | Arrays |
| 12 | [Reverse array in groups](https://leetcode.com/problems/reverse-string-ii/) | Leetcode #541 | easy | [solution](./arrays/easy/reverse-arr-in-groups.py) | Arrays |
| 13 | [Sort Colors](https://leetcode.com/problems/sort-colors/description/) | Leetcode #75 | easy | [solution](./arrays/easy/sort012.py) | Arrays |
| 14 | [Squares of sorted array](https://leetcode.com/problems/squares-of-a-sorted-array/) | Leetcode #977 | easy | [solution](./arrays/easy/sorted_squares.py) | Arrays |
| 15 | [Maximum difference between increasing elements](https://leetcode.com/problems/maximum-difference-between-increasing-elements/description/) | Leetcode #2016 | easy | [solution](./arrays/easy/max-difference-2-el.py) | Arrays |
| 16 | [Move zeroes](https://leetcode.com/problems/missing-number/description/) | Leetcode #283 | easy | [solution](./arrays/easy/movezeroes.py) | Arrays |
| 17 | [Missing Number](https://leetcode.com/problems/missing-number/description/) | Leetcode #268 | easy | [solution](./arrays/easy/missingno.py) | Arrays |
| 18 | [Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/description/) | Leetcode #118 | easy | [solution](./arrays/easy/pascals_triangle.py) | Arrays |
| 19 | [Triplet sum](https://leetcode.com/problems/3sum/) | Leetcode #15 | easy | [solution](./arrays/easy/triplet.py) | Arrays |
| 20 | [Three sum closest](https://leetcode.com/problems/3sum-closest/description/) | Leetcode #16 | medium | [solution](./arrays/medium/3sum.py) | Arrays |
| 21 | [Insert interval](https://leetcode.com/problems/insert-interval/) | Leetcode #57 | medium | [solution](./arrays/medium/insert_new_interval.py) | Arrays |
| 22 | [Rotate Function](https://leetcode.com/problems/rotate-function/) | Leetcode #396 | medium | [solution](./arrays/medium/max_sum_of_rotations.py) | Arrays |
| 23 | [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) | Leetcode #53 | medium | [solution](./arrays/medium/max_sum_subarray.py) | Arrays |
| 24 | [Merge Intervals](https://leetcode.com/problems/merge-intervals/) | Leetcode #56 | medium | [solution](./arrays/medium/merge_intervals.py) | Arrays |
| 25 | [Next Greater Element](https://leetcode.com/problems/next-greater-element-i/description/) | Leetcode #496 | medium | [solution](./arrays/medium/next_greater_element.py) | Arrays |
| 26 | [Partition Labels](https://leetcode.com/problems/partition-labels/) | Leetcode #763 | medium | [solution](./arrays/medium/partition_labels.py) | Arrays |
| 27 | [Product of Array except self](https://leetcode.com/problems/product-of-array-except-self/) | Leetcode #238 | medium | [solution](./arrays/medium/product_except_self.py) | Arrays |
| 28 | [Rotate Array](https://leetcode.com/problems/rotate-array/) | Leetcode #189 | medium | [solution](./arrays/medium/rotate.py) | Arrays |
| 29 | [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) | Leetcode #239 | medium | [solution](./arrays/medium/sliding-window-max.py) | Arrays |
| 30 | [Stock Span](https://leetcode.com/problems/online-stock-span/) | Leetcode #901 | medium | [solution](./arrays/medium/stock_span.py) | Arrays |
| 31 | [K Subarray Sum](https://leetcode.com/problems/subarray-sum-equals-k/) | Leetcode #560 | medium | [solution](./arrays/medium/subarray_sum.py) | Arrays |
| 32 | [Ugly Number](https://leetcode.com/problems/ugly-number-ii/) | Leetcode #264 | medium | [solution](./arrays/medium/uglynos.py) | Arrays |
| 33 | [Increasing Triplet Subsequence](https://leetcode.com/problems/increasing-triplet-subsequence/) | Leetcode #334 | pro | [solution](./arrays/pro/triplet_increasing_subsequence.py) | Arrays |
| 34 | [Number of 1 bits](https://leetcode.com/problems/number-of-1-bits/) | Leetcode #191 | easy | [solution](./bit%20manipulation/easy/hamming_weight.py) | Bit Manipulation |
| 35 | [reverse bits](https://leetcode.com/problems/reverse-bits/) | Leetcode #190 | easy | [solution](./bit%20manipulation/easy/reverse_unsigned_int_bits.py) | Bit Manipulation |
| 36 | [single number](https://leetcode.com/problems/single-number/) | Leetcode #136 | easy | [solution](./bit%20manipulation/easy/single_number.py) | Bit Manipulation |
| 37 | basic caeser cypher | | easy | [solution](./bruteforce/easy/cipher.py) | Brute Force |
| 38 | [Good pairs](https://leetcode.com/problems/number-of-good-pairs/%20) | Leetcode #1512 | easy | [solution](./bruteforce/easy/countpairs.py) | Brute Force |
| 39 | Find closest primes | | easy | [solution](./bruteforce/easy/magicwords.py) | Brute Force |
| 40 | Power function | | easy | [solution](./bruteforce/easy/power.py) | Brute Force |
| 41 | Submatrix Sum | | easy | [solution](./bruteforce/easy/submatrix_addition.py) | Brute Force |
| 42 | Disjoint Set | | easy | [solution](./disjoint%20set/easy/disjointset.py) | Disjoint Sets |
| 43 | [Most stones removed](https://leetcode.com/problems/most-stones-removed-with-same-row-or-column/%20) | Leetcode #947 | medium | [solution](./disjoint%20set/medium/most_stones_removed_with_same_row_or_column.py) | Disjoint Sets |
| 44 | [Number of Provinces](https://leetcode.com/problems/number-of-provinces/%20) | Leetcode #547 | medium | [solution](./disjoint%20set/medium/number_of_sets.py) | Disjoint Sets |
| 45 | [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/%20) | Leetcode #70 | easy | [solution](./dynamic%20programming/easy/climbing_stairs.py) | Dynamic Programming |
| 46 | Fibonacci | | easy | [solution](./dynamic%20programming/easy/fibonacci.py) | Dynamic Programming |
| 47 | [Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/%20) | Leetcode #746 | easy | [solution](./dynamic%20programming/easy/min_cost_climbing_stairs.py) | Dynamic Programming |
| 48 | Assembly line scheduling | | medium | [solution](./dynamic%20programming/medium/assembly_line_scheduling.py) | Dynamic Programming |
| 49 | [Coin Change](https://leetcode.com/problems/coin-change/%20) | Leetcode #322 | medium | [solution](./dynamic%20programming/medium/coin_change.py) | Dynamic Programming |
| 50 | Cutting Rod | | medium | [solution](./dynamic%20programming/medium/cutting_rod.py) | Dynamic Programming |
| 51 | [Edit Distance](https://leetcode.com/problems/edit-distance/%20) | Leetcode #72 | medium | [solution](./dynamic%20programming/medium/edit_distance.py) | Dynamic Programming |
| 52 | [House Robber](https://leetcode.com/problems/house-robber/%20) | Leetcode #198 | medium | [solution](./dynamic%20programming/medium/house_robber.py) | Dynamic Programming |
| 53 | Knapsack Problem | | medium | [solution](./dynamic%20programming/medium/knapsack.py) | Dynamic Programming |
| 54 | [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/%20) | Leetcode #1143 | medium | [solution](./dynamic%20programming/medium/lcs.py) | Dynamic Programming |
| 55 | Max sum subsequence | | medium | [solution](./dynamic%20programming/medium/max_sum_subsequence.py) | Dynamic Programming |
| 56 | [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/%20) | Leetcode #1143 | medium | [solution](./dynamic%20programming/medium/lcs.py) | Dynamic Programming |
| 57 | [Min path triangle](https://leetcode.com/problems/triangle/) | Leetcode #120 | medium | [solution](./dynamic%20programming/medium/min_path_triangle.py) | Dynamic Programming |
| 58 | [Unique Paths](https://leetcode.com/problems/unique-paths/%20) | Leetcode #120 | medium | [solution](./dynamic%20programming/medium/no_of_unique_paths.py) | Dynamic Programming |
| 59 | [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/%20) | Leetcode #416 | medium | [solution](./dynamic%20programming/medium/partition_equal_subset_sum.py) | Dynamic Programming |
| 60 | [Maximum product subarray](https://leetcode.com/problems/maximum-product-subarray/%20) | Leetcode #152 | pro | [solution](./dynamic%20programming/medium/max_product_subarray.py) | Dynamic Programming |
| 61 | Breadth First Search | | easy | [solution](./graphs/easy/bfs.py) | Graphs |
| 62 | Depth First Search | | easy | [solution](./dynamic%20programming/medium/lcs.py) | Graphs |
| 63 | Flood Fill | | easy | [solution](./dynamic%20programming/medium/lcs.py) | Graphs |
| 64 | [Number of Islands](https://leetcode.com/problems/number-of-islands/%20) | Leetcode #200 | medium | [solution](./graphs/medium/islands.py) | Graphs |
| 65 | [Max Area of Island](https://leetcode.com/problems/max-area-of-island/%20) | Leetcode #1152 | medium | [solution](./dynamic%20programming/medium/max_area_of_islands.py) | Graphs |
| 66 | [01 Matrix](https://leetcode.com/problems/01-matrix/%20) | Leetcode #542 | medium | [solution](./graphs/medium/nearest_zero.py) | Graphs |
| 67 | [Pacific atlantic water flow](https://leetcode.com/problems/pacific-atlantic-water-flow/%20) | Leetcode #417 | medium | [solution](./graphs/medium/pacific_atlantic_water_flow.py) | Graphs |
| 68 | [Rotting Oranges](https://leetcode.com/problems/rotting-oranges/) | Leetcode #994 | medium | [solution](./graphs/medium/rotting_oranges.py) | Graphs |
| 69 | [Valid Sudoku](https://leetcode.com/problems/valid-sudoku/%20) | Leetcode #36 | medium | [solution](./graphs/medium/valid_sudoku.py) | Graphs |
| 70 | [Find the Celebrity](https://leetcode.com/problems/find-the-celebrity/%20) | Leetcode #277 | pro | [solution](./graphs/pro/celebrity.py) | Graphs |
| 71 | Detect Cycle | | pro | [solution](./graphs/pro/detect_cycle.py) | Graphs |
| 72 | Topological Sort | | pro | [solution](./graphs/pro/topological_sort.py) | Graphs |
| 73 | [Longest Palindrome](https://leetcode.com/problems/longest-palindrome/%20) | Leetcode #409 | easy | [solution](./hashmaps/easy/longest_palindrome_length_zero.py) | Hashmaps |
| 74 | [Word Pattern](https://leetcode.com/problems/word-pattern/%20) | Leetcode #290 | easy | [solution](./hashmaps/easy/word_pattern.py) | Hashmaps |
| 75 | [Anagrams](https://www.hackerrank.com/challenges/sherlock-and-anagrams/problem%20) | | medium | [solution](./hashmaps/medium/anagrams.py) | Hashmaps |
| 76 | [Frequent Queries](https://www.hackerrank.com/challenges/frequency-queries/problem%20) | | medium | [solution](./hashmaps/medium/freq_queries.py) | Hashmaps |
| 77 | LRU | | medium | [solution](./hashmaps/medium/LRU.py) | Hashmaps |
| 78 | [Task Scheduler](https://leetcode.com/problems/task-scheduler/%20) | Leetcode #621 | medium | [solution](./hashmaps/medium/task_scheduler.py) | Hashmaps |
| 79 | [Bus Routes](https://leetcode.com/problems/bus-routes/%20) | Leetcode #815 | pro | [solution](./hashmaps/pro/bus_routes.py) | Hashmaps |
| 80 | LinkedList addition | | easy | [solution](./linkedlists/easy/addition.py) | Linked Lists |
| 81 | [Linked List Intersection](https://leetcode.com/problems/intersection-of-two-linked-lists/%20) | Leetcode #160 | easy | [solution](./linkedlists/easy/intersection.py) | Linked Lists |
| 82 | [Odd Even Linked List](https://leetcode.com/problems/odd-even-linked-list/%20) | Leetcode #328 | easy | [solution](./linkedlists/easy/odd_even_ll.py) | Linked Lists |
| 83 | [Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/%20) | Leetcode #234 | easy | [solution](./linkedlists/easy/palindrome_linked_list.py) | Linked Lists |
| 84 | [Remove Elements in Linked List](https://leetcode.com/problems/remove-linked-list-elements/%20) | Leetcode #203 | easy | [solution](./linkedlists/easy/remove_elements.py) | Linked Lists |
| 85 | [Remove Node Linked List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/%20) | Leetcode #19 | easy | [solution](./linkedlists/easy/remove_nth_node.py) | Linked Lists |
| 86 | [Swapping Nodes Linked List](https://leetcode.com/problems/swapping-nodes-in-a-linked-list/%20) | Leetcode #1721 | easy | [solution](./linkedlists/easy/swap.py) | Linked Lists |
| 87 | [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle-ii/%20) | Leetcode #142 | medium | [solution](./linkedlists/medium/cycle_detection.py) | Linked Lists |
| 88 | [Grouped Reverse Linked List](./Problem%20List.xlsx#%20https://leetcode.com/problems/reverse-nodes-in-k-group/) | Leetcode #25 | medium | [solution](./linkedlists/medium/grouped_reverse.py) | Linked Lists |
| 89 | [Flatten Multilevel Linked List](https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/) | Leetcode #430 | pro | [solution](./linkedlists/pro/flatten.py) | Linked Lists |
| 90 | [Reverse Integer](https://leetcode.com/problems/reverse-integer/%20) | Leetcode #7 | easy | [solution](./math/easy/reverse_integer.py) | Math |
| 91 | Hourglass Matrix | | easy | [solution](./matrices/easy/hourglass.py) | Matrices |
| 92 | Positional Elements in a Matrix | | easy | [solution](./matrices/easy/positional_elements.py) | Matrices |
| 93 | [Rotate Image](https://leetcode.com/problems/rotate-image/%20) | Leetcode #48 | medium | [solution](./matrices/medium/rotate.py) | Matrices |
| 94 | [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/) | Leetcode #73 | medium | [solution](./matrices/medium/setzeroes.py) | Matrices |
| 95 | [Spiral Matrix](https://leetcode.com/problems/spiral-matrix/%20) | Leetcode #54 | medium | [solution](./matrices/medium/spiral.py) | Matrices |
| 96 | [Where will the ball fall?](https://leetcode.com/problems/where-will-the-ball-fall/%20) | Leetcode #1706 | medium | [solution](./matrices/medium/where_will_the_ball_fall.py) | Matrices |
| 97 | Binary Search | | easy | [solution](./search/easy/binarysearch.py) | Search |
| 98 | [Search 2D matrix](https://leetcode.com/problems/search-a-2d-matrix-ii/%20) | Leetcode #240 | medium | [solution](./search/medium/matrix_search.py) | Search |
| 99 | [Minimum Rotated Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) | Leetcode #153 | medium | [solution](./search/medium/rotated_array.py) | Search |
| 100 | [Search sorted matrix](https://leetcode.com/problems/search-a-2d-matrix/%20) | Leetcode #74 | medium | [solution](./search/medium/sorted_matrix.py) | Search |
| 101 | Sorting Algoritms | | easy | [solution](./sorting/easy/sorting.py) | Sorting |
| 102 | Sorting Linked Lists | | medium | [solution](./sorting/medium/linkedlists_sorting.py) | Sorting |
| 103 | [Sliding Median](https://www.hackerrank.com/challenges/fraudulent-activity-notifications/problem%20) | | medium | [solution](./sorting/medium/slidingmedian.py) | Sorting |
| 104 | [K Large elements in Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | Leetcode #215 | pro | [solution](./sorting/pro/ksmallest.py) | Sorting |
| 105 | 3-way Partition | | pro | [solution](./sorting/pro/three_way_partition_in_a_range.py) | Sorting |
| 106 | [FIFO Queue using Stack](https://leetcode.com/problems/implement-queue-using-stacks/) | Leetcode #232 | easy | [solution](./stacks/easy/q_using_stacks.py) | Stacks |
| 107 | [Valid Parenthesis](https://leetcode.com/problems/valid-parentheses/) | Leetcode #20 | easy | [solution](./stacks/easy/valid_parenthesis.py) | Stacks |
| 108 | [Asteroid collision](https://leetcode.com/problems/asteroid-collision/) | Leetcode #735 | medium | [solution](./stacks/medium/asteroid_collision.py) | Stacks |
| 109 | [Calculator](https://leetcode.com/problems/basic-calculator-ii/) | Leetcode #227 | medium | [solution](./stacks/medium/calculator.py) | Stacks |
| 110 | [Decode String](https://leetcode.com/problems/decode-string/) | Leetcode #394 | medium | [solution](./stacks/medium/decode_string.py) | Stacks |
| 111 | [Remove Adjacent Duplicates](https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii/) | Leetcode #1209 | medium | [solution](./stacks/medium/shrink_burst_array.py) | Stacks |
| 112 | [Min Stack](https://leetcode.com/problems/min-stack/) | Leetcode #155 | pro | [solution](./stacks/pro/min_stack.py) | Stacks |
| 113 | [Valid Anagram](https://leetcode.com/problems/valid-anagram/) | Leetcode #242 | easy | [solution](./strings/easy/anagram.py) | Strings |
| 114 | [Backspace String Compare](https://leetcode.com/problems/backspace-string-compare/) | Leetcode #844 | easy | [solution](./strings/easy/backspace_compare.py) | Strings |
| 115 | [Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/) | Leetcode #14 | easy | [solution](./strings/easy/longest_common_prefix.py) | Strings |
| 116 | [Multiply Strings](https://leetcode.com/problems/multiply-strings/) | Leetcode #43 | easy | [solution](./strings/easy/mulitplication.py) | Strings |
| 117 | [Bulls and Cows](https://leetcode.com/problems/bulls-and-cows/) | Leetcode #299 | medium | [solution](./strings/medium/bulls_cows.py) | Strings |
| 118 | [Repeated DNA sequences](https://leetcode.com/problems/repeated-dna-sequences/) | Leetcode #187 | medium | [solution](./strings/medium/dna_sequences.py) | Strings |
| 119 | [K Frequent Words](https://leetcode.com/problems/top-k-frequent-words/) | Leetcode #692 | medium | [solution](./strings/medium/k_frequent_strings.py) | Strings |
| 120 | [Longest Palindrome](https://leetcode.com/problems/longest-palindrome-you-can-build/) | Leetcode #2131 | medium | [solution](./strings/medium/longest_palindrome_concatenating_two_letter.py) | Strings |
| 121 | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) | Leetcode #5 | medium | [solution](./strings/medium/longest_palindromic_substring.py) | Strings |
| 122 | [Longest repeating char replacement](https://leetcode.com/problems/longest-repeating-character-replacement/) | Leetcode #424 | medium | [solution](./strings/medium/longest_repeating_character_replacement.py) | Strings |
| 123 | [Longest substring without repeating chars](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | Leetcode #3 | medium | [solution](./strings/medium/longest-substring-without-repeating-chars.py) | Strings |
| 124 | [Permutation in string](https://leetcode.com/problems/permutation-in-string/) | Leetcode #567 | medium | [solution](./strings/medium/permutation_in_a_string.py) | Strings |
| 125 | [Min window substring](https://leetcode.com/problems/minimum-window-substring/) | Leetcode #76 | pro | [solution](./strings/pro/min_window_substring.py) | Strings |
| 126 | Smallest window containing another string | | pro | [solution](./strings/pro/smallest_substring_window.py) | Strings |
| 127 | Tree BFS | | easy | [solution](./trees/easy/bfs.py) | Trees |
| 128 | Binary Tree Inorder Traversal | | easy | [solution](./trees/easy/binarytree_inorder_traversal.py) | Trees |
| 129 | Binary Search Tree | | easy | [solution](./trees/easy/bst.py) | Trees |
| 130 | Inorder, Preorder, Postorder DFS | | easy | [solution](./trees/easy/dfs.py) | Trees |
| 131 | [Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree/) | Leetcode #110 | easy | [solution](./trees/easy/check_if_balanced.py) | Trees |
| 132 | [Binary Tree Diameter](https://leetcode.com/problems/diameter-of-binary-tree/) | Leetcode #543 | easy | [solution](./trees/easy/diameter.py) | Trees |
| 133 | [Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/) | Leetcode #226 | easy | [solution](./trees/easy/invert_tree.py) | Trees |
| 134 | [Lowest common ancestor BST](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) | Leetcode #235 | easy | [solution](./trees/easy/lowest_common_ancestor.py) | Trees |
| 135 | [Merge Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/) | Leetcode #617 | easy | [solution](./trees/easy/merge_binary_trees.py) | Trees |
| 136 | [N-ary tree preorder traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/) | Leetcode #589 | easy | [solution](./trees/easy/n-ary_preorder.py) | Trees |
| 137 | [Same Tree](https://leetcode.com/problems/same-tree/) | Leetcode #100 | easy | [solution](./trees/easy/same_tree.py) | Trees |
| 138 | [Sorted Array to BST](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/) | Leetcode #108 | easy | [solution](./trees/easy/sorted_array_bst.py) | Trees |
| 139 | [BST iterator implementation](https://leetcode.com/problems/binary-search-tree-iterator/) | Leetcode #173 | medium | [solution](./trees/medium/bst_iterator.py) | Trees |
| 140 | [Construct Tree from Preorder and Inorder](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | Leetcode #105 | medium | [solution](./trees/medium/build_tree_preorder_inorder.py) | Trees |
| 141 | [Course Schedule](https://leetcode.com/problems/course-schedule-ii/) | Leetcode #210 | medium | [solution](./trees/medium/course_schedule.py) | Trees |
| 142 | [kth smallest BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/) | Leetcode #230 | medium | [solution](./trees/medium/kth_smallest.py) | Trees |
| 143 | [Longest Univalue Path](https://leetcode.com/problems/longest-univalue-path/) | Leetcode #687 | medium | [solution](./trees/medium/longest_univalue_path.py) | Trees |
| 144 | [Path Sum](https://leetcode.com/problems/path-sum-ii/) | Leetcode #113 | medium | [solution](./trees/medium/path_sum.py) | Trees |
| 145 | [Populate next perfect BST](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/) | Leetcode #116 | medium | [solution](./trees/medium/populate_next_perfect_bst.py) | Trees |
| 146 | [BST side view](https://leetcode.com/problems/binary-tree-right-side-view/) | Leetcode #199 | medium | [solution](./trees/medium/right_side_view.py) | Trees |
| 147 | [Trie Implementation](https://leetcode.com/problems/implement-trie-prefix-tree/) | Leetcode #208 | medium | [solution](./trees/medium/trie.py) | Trees |
| 148 | [Validate BST](https://leetcode.com/problems/validate-binary-search-tree/) | Leetcode #98 | medium | [solution](./trees/medium/validate_bst.py) | Trees |