This repository is a curated, interview-focused collection of reusable code templates, problem-solving patterns, and optimized Python solutions to help you prepare for coding interviews. It covers all core data structures and algorithms, from arrays to dynamic programming and graphs.
- β Reusable Python templates for each pattern
- β Categorized by topic: arrays, trees, dp, graphs, etc.
- β Clean code & best practices
- β Interview-ready answers
- β
Personal
tracker.csvto log your progress
Click to expand
leetcode-patterns-python/
βββ arrays/
β βββ two_sum.py
β βββ group_anagrams.py
β βββ top_k_frequent.py
βββ twopointers/
β βββ three_sum.py
β βββ container_with_most_water.py
βββ sliding_window/
β βββ longest_substring.py
β βββ min_subarray_len.py
βββ stack_queue/
β βββ valid_parentheses.py
β βββ daily_temperatures.py
β βββ implement_queue_using_stacks.py
βββ linked_list/
β βββ reverse_linked_list.py
β βββ merge_two_sorted_lists.py
β βββ detect_cycle.py
β βββ middle_node.py
βββ trees/
β βββ max_depth.py
β βββ invert_tree.py
β βββ level_order_traversal.py
β βββ symmetric_tree.py
βββ backtracking/
β βββ subsets.py
β βββ permutations.py
β βββ combination_sum.py
βββ dp/
β βββ climb_stairs.py
β βββ house_robber.py
β βββ coin_change.py
β βββ longest_increasing_subsequence.py
βββ graphs/
β βββ num_islands.py
β βββ clone_graph.py
β βββ rotting_oranges.py
β βββ course_schedule.py
βββ tracker.csv # Practice log
βββ README.md
Use this to track your LeetCode journey!
| Category | Patterns & Techniques |
|---|---|
| Arrays & Hashes | Two Sum, Group Anagrams, Top-K Frequent |
| Two Pointers | 3Sum, Container With Most Water |
| Sliding Window | Longest Substring, Min Subarray Length |
| Stack/Queue | Valid Parentheses, Monotonic Stack, Implement Queue |
| Linked Lists | Reversal, Cycle Detection, Merging, Middle |
| Trees | DFS, BFS, Inversion, Symmetry |
| Backtracking | Subsets, Permutations, Combination Sum |
| Dynamic Prog. | Climb Stairs, House Robber, Coin Change |
| Graphs | DFS/BFS, Islands, Clone Graph, Topological Sort |
- Add more templates (e.g. Tries, Union-Find, Segment Trees)
- Add test cases using
unittest - Add Markdown notes for each topic
Pull requests and improvements welcome!