A structured, pattern-based roadmap to crack the DSA round at FAANG and any top tech company β from Easy β Hard. Every solution is clean, commented, and tagged with its complexity.
β Star this repo if it helps your prep β it keeps you accountable and helps others find it!
Most people "grind" 300 random problems and still freeze in interviews. Patterns beat problems. Once you recognize the shape of a problem, the solution writes itself.
This repo is built around 18 core patterns (the NeetCode-style roadmap). Follow the order, and you'll cover ~90% of what interviewers actually ask.
- β Pattern-first β learn the technique, not just the answer
- β Easy β Hard progression within each topic
- β Every solution has intuition + time/space complexity
- β Consistent, readable Java style
- β A progress tracker so you can mark what's done
Follow the patterns top to bottom. Each builds on the last.
| # | Pattern | Folder | Why it matters |
|---|---|---|---|
| 01 | Arrays & Hashing | 01-arrays-and-hashing |
The foundation β HashMap/HashSet tricks |
| 02 | Two Pointers | 02-two-pointers |
Sorted arrays, palindromes, pair-finding |
| 03 | Sliding Window | 03-sliding-window |
Subarrays/substrings in O(n) |
| 04 | Stack | 04-stack |
Matching, monotonic stacks |
| 05 | Binary Search | 05-binary-search |
Search space reduction |
| 06 | Linked List | 06-linked-list |
Pointers, cycles, reversal |
| 07 | Trees | 07-trees |
DFS/BFS, BST properties |
| 08 | Tries | 08-tries |
Prefix trees, autocomplete |
| 09 | Heap / Priority Queue | 09-heap-priority-queue |
Top-K, streaming medians |
| 10 | Backtracking | 10-backtracking |
Subsets, permutations, combos |
| 11 | Graphs | 11-graphs |
Islands, BFS/DFS, topo sort |
| 12 | Advanced Graphs | 12-advanced-graphs |
Dijkstra, Union-Find, MST |
| 13 | 1-D Dynamic Programming | 13-1d-dynamic-programming |
The classic DP intro |
| 14 | 2-D Dynamic Programming | 14-2d-dynamic-programming |
Grids, strings, knapsack |
| 15 | Greedy | 15-greedy |
Local β global optimum |
| 16 | Intervals | 16-intervals |
Merge, overlap, scheduling |
| 17 | Math & Geometry | 17-math-and-geometry |
Rotations, number theory |
| 18 | Bit Manipulation | 18-bit-manipulation |
XOR tricks, bit counting |
π Full problem checklist with difficulty tags: ROADMAP.md
DSA-Decoded/
βββ README.md β you are here
βββ ROADMAP.md β full 150+ problem checklist
βββ SOLUTION_TEMPLATE.java β copy this for every new problem
βββ CONTRIBUTING.md
βββ LICENSE
βββ patterns/
βββ 01-arrays-and-hashing/
β βββ README.md β pattern intuition + problem list
β βββ TwoSum.java β example solution
βββ 02-two-pointers/
β βββ ...
βββ ... (18 patterns)
Each solution file is self-contained and runnable (public class with a header comment carrying problem link, difficulty, and complexity).
- Pick a pattern from the roadmap (start at
01). - Read the pattern's
README.mdto understand the technique. - Attempt the problem yourself first (15β30 min).
- Compare with the solution here, then re-solve from scratch.
- Mark it done in the progress tracker.
- Repeat. Consistency > intensity.
# Compile and run any single file (Java 11+ supports this directly)
java patterns/01-arrays-and-hashing/TwoSum.javaTip: copy this into your own fork and check boxes as you go.
| Pattern | Easy | Medium | Hard | Status |
|---|---|---|---|---|
| Arrays & Hashing | β¬ | β¬ | β¬ | π |
| Two Pointers | β¬ | β¬ | β¬ | π |
| Sliding Window | β¬ | β¬ | β¬ | π |
| Stack | β¬ | β¬ | β¬ | π |
| Binary Search | β¬ | β¬ | β¬ | π |
| Linked List | β¬ | β¬ | β¬ | π |
| Trees | β¬ | β¬ | β¬ | π |
| Tries | β¬ | β¬ | β¬ | π |
| Heap / PQ | β¬ | β¬ | β¬ | π |
| Backtracking | β¬ | β¬ | β¬ | π |
| Graphs | β¬ | β¬ | β¬ | π |
| Advanced Graphs | β¬ | β¬ | β¬ | π |
| 1-D DP | β¬ | β¬ | β¬ | π |
| 2-D DP | β¬ | β¬ | β¬ | π |
| Greedy | β¬ | β¬ | β¬ | π |
| Intervals | β¬ | β¬ | β¬ | π |
| Math & Geometry | β¬ | β¬ | β¬ | π |
| Bit Manipulation | β¬ | β¬ | β¬ | π |
Legend: β done Β· π‘ in progress Β· π not started
| Big-O | Name | Example |
|---|---|---|
| O(1) | Constant | HashMap lookup |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Single loop |
| O(n log n) | Linearithmic | Sorting |
| O(nΒ²) | Quadratic | Nested loops |
| O(2βΏ) | Exponential | Subsets / brute backtracking |
Found a cleaner solution or a typo? PRs welcome! See CONTRIBUTING.md.
MIT β free to use, learn, and share.
If this repo helped you, drop a β and share it with someone grinding for interviews.
Happy decoding! π