Skip to content

joshydavid/leetcode-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode 🐡

πŸ“‚ Repository Structure

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/

πŸ“– Solutions Catalog

πŸ“š Arrays

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

πŸ”™ Backtracking

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

πŸ” Binary Search

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

πŸ“ˆ Dynamic Programming

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

πŸ“‰ Graphs

Problem Solution File
BFS Adjacency List graphs/breadth-first-search/bfs_adj_list.py
BFS Adjacency List Level Order graphs/breadth-first-search/bfs_adj_list_level_order.py
BFS Matrix graphs/breadth-first-search/bfs_matrix.py
Bus Routes graphs/breadth-first-search/bus_routes.py
Minimum Knight Moves graphs/breadth-first-search/min_knight_moves.py
Rotting Oranges graphs/breadth-first-search/rotting_orange.py
Dijkstra Algorithm graphs/breadth-first-search/shortest-path/dijkstra_algo.py
Network Delay Time graphs/breadth-first-search/shortest-path/network_delay_time.py
Boundary of Binary Tree graphs/depth-first-serach/boundary.py
DFS Adjacency List graphs/depth-first-serach/dfs_adj_list.py
DFS Matrix graphs/depth-first-serach/dfs_matrix.py
Find if Path Exists in Graph graphs/depth-first-serach/find_if_path_exists.py
Max Area of Island graphs/depth-first-serach/max_area_islands.py
Find Max Fishes graphs/depth-first-serach/max_fishes.py
Number of Closed Islands graphs/depth-first-serach/num_closed_islands.py
Number of Islands graphs/depth-first-serach/num_islands.py
Surrounded Regions graphs/depth-first-serach/surrounded_regions.py
Course Schedule graphs/kahn-algo/course_schedule.py
Course Schedule II graphs/kahn-algo/course_schedule_ii.py
Find Eventual Safe States graphs/kahn-algo/eventual_safe_nodes.py

πŸ€‘ Greedy

Problem Solution File
Assign Cookies greedy/assign_cookies.py
Jump Game greedy/jump_game.py

🌳 Heaps

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

πŸ—“οΈ Intervals

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

πŸ”— Linked List

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

πŸͺŸ Sliding Window

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

πŸ”€ Sorting

Problem Solution File
Merge Sort sorting/merge_sort.py
Quick Sort sorting/quick_sort.py

πŸ₯ž Stacks

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

🌲 Trees

Problem Solution File
Binary Tree Implementation trees/binary_tree.py
Invert Binary Tree trees/invert_binary_tree.py
Kth Smallest Element in a BST trees/kth_smallest_bst.py
Same Tree trees/same_tree.py
Symmetric Tree trees/symmetric_tree.py
Validate Binary Search Tree trees/validate_bst.py
Binary Tree Paths trees/backtracking/binary_tree_path.py
Path Sum II trees/backtracking/path_sum_ii.py
Level Order Traversal trees/breadth-first-search/level_order.py
Zigzag Level Order Traversal trees/breadth-first-search/zigzag_level_order.py
Inorder Traversal trees/depth-first-search/bt_inorder.py
Postorder Traversal trees/depth-first-search/bt_postorder.py
Preorder Traversal trees/depth-first-search/bt_preorder.py
Count Good Nodes in Binary Tree trees/depth-first-search/count_good.py
Maximum Depth of Binary Tree trees/depth-first-search/max_depth.py
Path Sum trees/depth-first-search/path_sum.py
Sum of All Nodes trees/depth-first-search/sum_of_nodes.py
Sum Root to Leaf Numbers trees/depth-first-search/sum_root_to_leaf.py

🌳 Trie

Problem Solution File
Implement Trie (Prefix Tree) trie/implementation.py