My solutions to LeetCode problems, organized by topic as I work through NeetCode 150. Each solution includes my approach, time/space complexity, and notes on patterns I'm learning.
| # |
Problem |
Difficulty |
Pattern |
Solution |
| 1 |
Two Sum |
Easy |
Brute Force |
solution.py |
| 242 |
Valid Anagram |
Easy |
Hash Map |
solution.py |
| 49 |
Group Anagrams |
Medium |
Hash Map |
solution.py |
| 217 |
Contains Duplicate |
Easy |
Hash Set |
solution.py |
| 219 |
Contains Duplicate II |
Easy |
Hash Map |
solution.py |
| 220 |
Contains Duplicate III |
Hard |
Bucketing |
solution.py |
| 347 |
Top K Frequent Elements |
Medium |
Bucket Sort |
solution.py |
| 271 |
Encode and Decode Strings |
Medium |
String Encoding |
solution.py |
| 238 |
Product of Array Except Self |
Medium |
Prefix/Suffix |
solution.py |
| 36 |
Valid Sudoku |
Medium |
Hash Set |
solution.py |
| 128 |
Longest Consecutive Sequence |
Medium |
Hash Set |
solution.py |
| # |
Problem |
Difficulty |
Pattern |
Solution |
| 125 |
Valid Palindrome |
Easy |
Two Pointers |
solution.py |
| 167 |
Two Sum II |
Medium |
Two Pointers |
solution.py |
| 15 |
3Sum |
Medium |
Two Pointers |
solution.py |
| 11 |
Container With Most Water |
Medium |
Two Pointers |
solution.py |
| 42 |
Trapping Rain Water |
Hard |
Two Pointers |
solution.py |
| # |
Problem |
Difficulty |
Pattern |
Solution |
| 121 |
Best Time to Buy and Sell Stock |
Easy |
Sliding Window |
solution.py |
| 3 |
Longest Substring Without Repeating Characters |
Medium |
Sliding Window |
solution.py |
| 424 |
Longest Repeating Character Replacement |
Medium |
Sliding Window |
solution.py |
| 567 |
Permutation in String |
Medium |
Fixed Window |
solution.py |
| 76 |
Minimum Window Substring |
Hard |
Variable Window |
solution.py |
| 239 |
Sliding Window Maximum |
Hard |
Monotonic Deque |
solution.py |
| # |
Problem |
Difficulty |
Pattern |
Solution |
| 20 |
Valid Parentheses |
Easy |
Stack |
solution.py |
| 155 |
Min Stack |
Medium |
Stack |
solution.py |
| 150 |
Evaluate Reverse Polish Notation |
Medium |
Stack |
solution.py |
| 739 |
Daily Temperatures |
Medium |
Monotonic Stack |
solution.py |
| 853 |
Car Fleet |
Medium |
Stack |
solution.py |
| 84 |
Largest Rectangle in Histogram |
Hard |
Monotonic Stack |
solution.py |
| # |
Problem |
Difficulty |
Pattern |
Solution |
| 704 |
Binary Search |
Easy |
Binary Search |
solution.py |
| 74 |
Search a 2D Matrix |
Medium |
Binary Search |
solution.py |
| 875 |
Koko Eating Bananas |
Medium |
Binary Search on Answer |
solution.py |
| 153 |
Find Minimum in Rotated Sorted Array |
Medium |
Binary Search |
solution.py |
| 33 |
Search in Rotated Sorted Array |
Medium |
Binary Search |
solution.py |
| 981 |
Time Based Key-Value Store |
Medium |
Binary Search |
solution.py |
| 4 |
Median of Two Sorted Arrays |
Hard |
Binary Search |
solution.py |
Solutions are organized by topic:
arrays-hashing/
two-pointers/
sliding-window/
stack/
binary-search/
linked-list/
trees/
tries/
heap-priority-queue/
backtracking/
graphs/
dynamic-programming/
greedy/
intervals/
math-geometry/
Each problem folder contains a solution.py and a README.md with notes on approach and complexity.