Practiced Patterns
This document tracks the algorithmic patterns encountered while solving LeetCode problems.
The goal is not to measure mastery, but to record exposure. A pattern is added once it has been implemented in at least one problem. As more exercises are solved, the lists grow, making it easier to identify which techniques have been practiced repeatedly and which still need focused work.
The tables below provide two complementary views:
- Practiced patterns: groups problems by the primary algorithmic technique they exercise.
- Patterns by problem: records the main pattern(s) used to solve each individual problem.
Patterns
| Pattern | Notes | Problems |
|---|---|---|
| Array / Linear Scan | The "default" pattern. Many Easy problems are just one pass over an array or string. | #01 #13 #14 #28 |
| In-place Edit | Modify the existing container while maintaining a write index | #26 #27 |
| String | String-specific manipulation/search. | #14 |
| String Search | Find the first occurrence of a pattern within a larger string. | #28 |
| Linked List | Separate from Two Pointers because the mechanics differ. | #21 |
| Hash Table | Dictionaries, sets, counting, lookups. | #01 #13 #20 |
| Stack | LIFO problems. | #20 |
| Queue | FIFO problems. | |
| Two Pointers | Left/right, fast/slow, read/write. | #09 #21 #26 #27 |
| Sliding Window | Dynamic intervals. | |
| Binary Search | Search over ordered space. | #14 #35 |
| Tree DFS/BFS | Tree traversals. | # |
| Graph DFS/BFS | Graph traversals. | |
| Heap / Priority Queue | Top-K, scheduling, streaming. | |
| Backtracking | Search with undo. | |
| Dynamic Programming | Memoization/state transitions. | |
| Greedy | Locally optimal choices. | |
| ## Problems |
| Problem | Primary Pattern | Secondary Pattern |
|---|---|---|
| #1 Two Sum | HashMap | Array |
| #9 Palindrome Number | Two pointers (or half-reversal) | Math |
| #13 Roman to Integer | HashMap | Linear scan |
| #14 Longest Common Prefix | String | Linear scan |
| #20 Valid Parentheses | Stack | HashMap (matching pairs) |
| #21 Merge Two Sorted Lists | Two pointers | Linked List |
| #26 Remove Duplicates from Sorted Array | Two pointers | In-place array |
| #27 Remove Element | Two pointers | In-place filtering |
| #28 Find First Occurrence | String Search | Linear scan |
| #35 Search Insert Position |