DSA Plan for Backend Interviews
Goal of this file: Give you a focused DSA plan that maximizes ROI for backend interviews (no unnecessary topics).
1. Topics Overview (Backend-Relevant Only)β
| Topic | Why It Matters for Backend |
|---|---|
| Arrays & Strings | Parsing requests, basic transformations, validation |
| Hash Maps & Sets | Caching, de-duplication, counting, indexing-like logic |
| Linked Lists | LRU cache, queues, streaming structures |
| Stacks & Queues | Request processing, parsing, BFS/DFS helpers |
| Trees | Hierarchical data (folders, comments), search |
| Graphs | Networks, dependency graphs, shortest paths |
| Heaps/Priority Queues | Scheduling, task prioritization, top-K queries |
| Two Pointers | Windowed processing on sorted/linear data |
| Sliding Window | Streaming analytics, rate limiting, rolling metrics |
You donβt need dynamic programming mastery for most backend SDE-II roles; focus instead on these core patterns.
2. Weekly Plan (16-Week Track)β
This runs in parallel with other phases. See week-XX.md for daily allocations.
| Weeks | Focus | Problems / Day |
|---|---|---|
| 1β2 | Arrays, strings, hash maps, sets | 3 |
| 3β4 | Two pointers, sliding window | 3β4 |
| 5β6 | Linked lists, stacks, queues | 3 |
| 7β8 | Trees (BST, generic) | 3 |
| 9β10 | Graphs (BFS/DFS, shortest path) | 3 |
| 11β12 | Heaps, top-K, scheduling-like problems | 3 |
| 13β14 | Mixed revision, timed practice | 4 |
| 15β16 | Mixed revision + company-style sets | 4β5 |
3. Pattern-Based Study Planβ
Arrays & Stringsβ
-
Key Patterns
- Frequency counting using hash maps.
- Prefix sums (basic).
- In-place modifications, two-pointer sweeps.
-
Checklist
- Can I:
- Use a hash map for counting/lookup in (O(1)) average time?
- Reason about off-by-one errors with indices?
- Detect and handle Unicode/edge cases in strings (conceptually)?
- Can I:
Hash Maps & Setsβ
-
Key Patterns
- Detect duplicates.
- Mapping from ID to object/metadata.
- Grouping (e.g., by category or key).
-
Checklist
- Can I design an API that uses a map/set internally to support (O(1)) operations?
Two Pointers & Sliding Windowβ
-
Two Pointers
- Sorted arrays merging, partitioning, removing elements in-place.
-
Sliding Window
- Longest/shortest subarray satisfying condition.
- Maintaining counts or sums in a moving window.
-
ASCII View
Array: [a, b, c, d, e, f]
Window (size 3) moves:
[a, b, c] -> [b, c, d] -> [c, d, e] -> [d, e, f]
l r l r l r l r
4. Recommended Problem Mix (Per Topic)β
Replace "PlatformProblemName" with actual problem names from your preferred platform.
| Topic | Easy | Medium | Notes |
|---|---|---|---|
| Arrays & Strings | 5 | 10 | Focus on frequency counting & subarrays |
| Hash Maps/Sets | 5 | 10 | Use maps for counting & indexing |
| Linked Lists | 5 | 5 | Reversal, middle, cycle detection |
| Trees | 5 | 10 | BFS/DFS, height, lowest common ancestor |
| Graphs | 3 | 7 | BFS/DFS, shortest path, topological sort |
| Heaps/PQ | 3 | 7 | Top-K, scheduling, merging sorted lists |
| Sliding Window | 5 | 10 | Longest/shortest subarray/window |
5. Daily Template (4-Hour and 6-Hour Days)β
-
4-Hour Day DSA Block (Integrated with Other Topics)
- Warm-up (10β15 min): 2β3 quick easy problems or reading old notes.
- Focused practice (60β75 min): 2β3 new medium problems on 1 topic.
- Review (10β15 min): Document patterns and mistakes.
-
6-Hour Day DSA Block
- Same as above, but add:
- 1 extra medium problem.
- 1 timed problem (25β30 minutes).
- Same as above, but add:
6. How to Review and Build Patternsβ
- After solving a problem:
- Write 1β3 bullet points:
- Which pattern did this use? (e.g., sliding window, BFS, heap).
- What was the invariant you maintained?
- What common pitfall did you avoid or fall into?
- Write 1β3 bullet points:
- Build a personal pattern cheat sheet:
- Example sections: "Sliding Window", "Two Pointers", "Top-K with Heap", "Graph Traversal".
7. Company-Focused Rounds (Weeks 15β16)β
- Create sets of 2β3 problems that you solve in 75 minutes:
- 1 array/hash map problem.
- 1 tree/graph/heap problem.
- 1 sliding window or two-pointer problem.
- After each set:
- Grade yourself on:
- Correctness (did you handle edge cases?).
- Complexity (can you justify it?).
- Communication (could an interviewer follow your reasoning?).
- Grade yourself on: