A public interview-prep journal for turning LeetCode practice into reusable patterns, not just final answers.
Each problem entry includes the final Python solution, complexity analysis, pitfalls, breakthroughs, and a short mental model to make the pattern easier to recognize in interviews.
| Problem | Difficulty | Pattern |
|---|---|---|
| Two Sum | Easy | Hash map lookup |
| Contains Duplicate | Easy | Hash set membership |
| Valid Anagram | Easy | Frequency counting |
| Valid Palindrome | Easy | Opposite-end two pointers |
| Remove Duplicates from Sorted Array | Easy | Two pointers / in-place array |
| Find the Index of the First Occurrence in a String | Easy | Fixed-size sliding window |
| Linked List Cycle | Easy | Fast/slow pointers |
| Reverse Linked List | Easy | Linked list pointer reversal |
| Merge Two Sorted Lists | Easy | Dummy node / tail pointer |
| Best Time to Buy and Sell Stock | Easy | Running minimum / max profit |
| Binary Search | Easy | Binary search |
| Group Anagrams | Medium | Frequency signature grouping |
| Two Sum II - Input Array Is Sorted | Medium | Opposite-end two pointers |
| Container With Most Water | Medium | Opposite-end two pointers |
| 3Sum | Medium | Sorting / two pointers |
| Top K Frequent Elements | Medium | Frequency map / heap |
| Product of Array Except Self | Medium | Prefix/suffix products |
| Longest Substring Without Repeating Characters | Medium | Variable sliding window |
| Permutation in String | Medium | Fixed-size sliding window |
| Longest Repeating Character Replacement | Medium | Variable sliding window |
| Rotate Image | Medium | Matrix transforms |
| Valid Sudoku | Medium | Constraint tracking with sets |
| Longest Consecutive Sequence | Medium | Hash set / sequence starts |
| Encode and Decode Strings | Medium | Length-prefix encoding |
| Pow(x, n) | Medium | Divide and conquer |
| Reorder List | Medium | Linked lists / two pointers |
| Remove Nth Node From End of List | Medium | Linked list fast/slow pointers |
| Search a 2D Matrix | Medium | Binary search |
| Course Schedule | Medium | Graph DFS / cycle detection |
| Course Schedule II | Medium | Graph DFS / topological ordering |
| Walls and Gates | Medium | Multi-source grid BFS |
| Word Ladder | Hard | BFS / implicit graph |
| Trapping Rain Water | Hard | Two pointers / running maximums |
| Minimum Window Substring | Hard | Variable sliding window |
| Sliding Window Maximum | Hard | Monotonic deque |
| Implement Trie (Prefix Tree) | Medium | Trie / prefix tree |
| Find the Duplicate Number | Medium | Floyd's cycle detection |
| Car Fleet | Medium | Ordered sweep / monotonic state |
| Best Time to Buy and Sell Stock with Cooldown | Medium | DP / memoized state search |
- Clear problem decomposition under interview constraints.
- Python implementations with time and space complexity.
- Notes on mistakes and boundary cases, not only polished final code.
- Small commits that show steady practice and reflection.
- Create a new problem folder.
- Start your timer.
- Work in the problem folder and leave notes as you go.
- Commit when you finish or hit a useful stopping point.
python3 scripts/new_problem.py "Two Sum" easyThis creates a folder under problems/ with:
README.mdfor timing, notes, insights, and reflection.solution.pyfor the main solution.alternatives.mdfor other approaches you try later.
Use small commits so your GitHub activity tells the story:
git add .
git commit -m "Solve two sum"For partial progress:
git commit -m "Work through two sum brute force"