The solutions are organised into directories based on the primary data structure or algorithm used.
leetcode/
βββ arrays/
βββ backtracking/
βββ binary-search/
βββ dynamic-programming/
βββ graphs/
βββ greedy/
βββ heaps/
βββ intervals/
βββ linked-list/
βββ sliding-window/
βββ sorting/
βββ stacks/
βββ trees/
βββ trie/
| Problem | Solution File |
|---|---|
| Add Strings | arrays/add_strs.py |
| Compare Version Numbers | arrays/compare_ver_number.py |
| Container With Most Water | arrays/container_most_water.py |
| Count Digit | arrays/count_digit.py |
| Find Numbers with Even Number of Digits | arrays/find_numbers.py |
| Group Anagrams | arrays/group_anagrams.py |
| Longest Common Prefix | arrays/longest_common_prefix.py |
| Longest Consecutive Sequence | arrays/longest_consecutive_seq.py |
| Make Pattern | arrays/make_pattern.py |
| Max Consecutive Ones | arrays/max_consecutive.ones.py |
| Maximum Subarray | arrays/max_subarray.py |
| Merge Strings Alternately | arrays/merge_str.py |
| Move Zeroes | arrays/move_zeroes.py |
| Remove Duplicates from Sorted Array | arrays/remove_dup_sorted_arr.py |
| Reverse String | arrays/reverse_str.py |
| Rotate Array | arrays/rotate_array.py |
| Rotate Array | arrays/rotated_array.py |
| Sort Colors | arrays/sort_colors.py |
| Squares of a Sorted Array | arrays/squares_of_sorted_arr.py |
| Three Sum | arrays/three_sum.py |
| Two Sum II | arrays/two_sum_ii.py |
| Valid Anagram | arrays/valid_anagram.py |
| Problem | Solution File |
|---|---|
| Combination Sum | backtracking/combination_sum.py |
| Combination Sum II | backtracking/combination_sum_ii.py |
| Letter Combinations of a Phone Number | backtracking/letter_combination.py |
| Permutations | backtracking/permutation.py |
| Subsets | backtracking/subset.py |
| Word Search | backtracking/word_search.py |
| Problem | Solution File |
|---|---|
| First Bad Version | binary_search/bad_version.py |
| Find Minimum in Rotated Sorted Array | binary_search/find_min_rotated_sorted.py |
| Find Peak Element | binary_search/find_peak_element.py |
| Koko Eating Bananas | binary_search/koko_eating_bananas.py |
| Minimum Number of Bouquets | binary_search/make_bouquets.py |
| Capacity To Ship Packages Within D Days | binary_search/ship_capacity.py |
| Traditional Binary Search | binary_search/traditional.py |
| Problem | Solution File |
|---|---|
| Climbing Stairs | dynamic-programming/climb_stairs.py |
| Fibonacci Number | dynamic-programming/fib.py |
| House Robber | dynamic-programming/house_robber.py |
| House Robber II | dynamic-programming/house_robber_ii.py |
| Knapsack 2D | dynamic-programming/knapsack_2d.py |
| Maximum Subarray | dynamic-programming/max_subarr.py |
| Min Cost Climbing Stairs | dynamic-programming/min_cost_climb_stairs.py |
| Unique Paths | dynamic-programming/unique_paths.py |
| Unique Paths II | dynamic-programming/unique_paths_ii.py |
| Problem | Solution File |
|---|---|
| Assign Cookies | greedy/assign_cookies.py |
| Jump Game | greedy/jump_game.py |
| Problem | Solution File |
|---|---|
| Find Score of an Array After Marking All Elements | heaps/find_score.py |
| Find K Closest Elements | heaps/k_closest_element.py |
| K Closest Points to Origin | heaps/k_closest_origin.py |
| Kth Largest Element in an Array | heaps/kth_largest.py |
| Last Stone Weight | heaps/last_stone_weight.py |
| Meeting Rooms II | heaps/meeting_rooms_ii.py |
| Merge K Sorted Lists | heaps/merge_k_sorted_lists.py |
| Top K Frequent Elements | heaps/top_k_freq_elements.py |
| Top K Largest Elements | heaps/top_k_largest.py |
| Problem | Solution File |
|---|---|
| Meeting Rooms | intervals/meeting_rooms.py |
| Meeting Rooms II | intervals/meeting_rooms_2.py |
| Merge Intervals | intervals/merge_intervals.py |
| Non-overlapping Intervals | intervals/non_overlapping_intervals.py |
| Problem | Solution File |
|---|---|
| Linked List Cycle | linked-list/cycle_detection.py |
| LRU Cache | linked-list/lru_cache.py |
| Merge K Sorted Lists | linked-list/merge_k_sorted_lists.py |
| Merge Two Sorted Lists | linked-list/merge_tsl.py |
| Middle of the Linked List | linked-list/middle_linked_lists.py |
| Remove Duplicates from Sorted List | linked-list/remove_dup_lists.py |
| Reverse Linked List | linked-list/reverse_linked_list.py |
| Problem | Solution File |
|---|---|
| Longest Repeating Character Replacement | sliding-window/longest_repeating_replacement.py |
| Longest Substring Without Repeating Characters | sliding-window/longest_substr.py |
| Max Consecutive Ones III | sliding-window/max_consecutive_ones_iii.py |
| Maximum Sum Subarray of Size K | sliding-window/max_sum_subarray.py |
| Permutation in String | sliding-window/permutation_in_str.py |
| Problem | Solution File |
|---|---|
| Merge Sort | sorting/merge_sort.py |
| Quick Sort | sorting/quick_sort.py |
| Problem | Solution File |
|---|---|
| Baseball Game | stacks/baseball_game.py |
| Daily Temperatures | stacks/daily_temperature.py |
| Decode String | stacks/decode_str.py |
| Evaluate Reverse Polish Notation | stacks/evaluate_reverse_polish.py |
| Implement Stack using Queues | stacks/implement_using_queue.py |
| Next Greater Element I | stacks/next_greater_elem.py |
| Valid Parentheses | stacks/valid_parentheses.py |
| Problem | Solution File |
|---|---|
| Implement Trie (Prefix Tree) | trie/implementation.py |