Skip to content

RezaeiAl/leetcode-patterns-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

Python Version

🧠 Python LeetCode Patterns & Cheat Sheet

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.


πŸš€ What's Included

  • βœ… Reusable Python templates for each pattern
  • βœ… Categorized by topic: arrays, trees, dp, graphs, etc.
  • βœ… Clean code & best practices
  • βœ… Interview-ready answers
  • βœ… Personal tracker.csv to log your progress

πŸ“‚ Repository Structure

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

🧩 Practice Tracker (tracker.csv)

Use this to track your LeetCode journey!


🧠 Key Topics Covered

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

πŸ“Œ TODOs

  • Add more templates (e.g. Tries, Union-Find, Segment Trees)
  • Add test cases using unittest
  • Add Markdown notes for each topic

πŸ“« Contact

Pull requests and improvements welcome!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors