A community-driven, open-source study guide for Data Structures & Algorithms — written entirely in TypeScript.
DSA Mastery is an open-source repository of 216 curated algorithm problems across 12 core categories — each one written in the style of a real technical interview question.
Every problem includes:
- A complete problem statement with real constraints
- Multiple worked examples
- A dedicated edge cases section
- A full TypeScript solution with strict typing
- A step-by-step explanation of the approach
- Time and space complexity analysis
- Runnable test cases
This is not a collection of bare code snippets. Every solution is a teaching document — designed so you actually understand the pattern, not just memorize an answer.
- Software engineers preparing for technical interviews (FAANG, startups, anywhere)
- CS students learning data structures and algorithms for the first time
- Self-taught developers building a solid algorithmic foundation
- Anyone who wants a free, high-quality, community-maintained alternative to paid platforms
No subscription. No paywall. Fork it, star it, contribute to it.
Browse the folders below. Every problem is a standalone Markdown file that renders beautifully in GitHub's UI.
git clone https://github.com/your-username/dsa-mastery.git
cd dsa-mastery
npm install
npm testTypeScript solutions can be run directly:
npx ts-node 01-arrays-and-strings/easy/01-two-sum.tscategory-folder/
├── README.md ← category overview and full problem index
├── easy/ ← 10 problems
├── medium/ ← 5 problems
└── hard/ ← 3 problems
Start with a category README to see the full problem list, then open any problem file.
| # | Category | Easy | Medium | Hard | Total |
|---|---|---|---|---|---|
| 01 | Arrays & Strings | 10 | 5 | 3 | 18 |
| 02 | Linked Lists | 10 | 5 | 3 | 18 |
| 03 | Stacks & Queues | 10 | 5 | 3 | 18 |
| 04 | Binary Trees | 10 | 5 | 3 | 18 |
| 05 | Binary Search Trees | 10 | 5 | 3 | 18 |
| 06 | Graphs | 10 | 5 | 3 | 18 |
| 07 | Dynamic Programming | 10 | 5 | 3 | 18 |
| 08 | Sorting & Searching | 10 | 5 | 3 | 18 |
| 09 | Hash Tables & Sets | 10 | 5 | 3 | 18 |
| 10 | Heaps & Priority Queues | 10 | 5 | 3 | 18 |
| 11 | Two Pointers & Sliding Window | 10 | 5 | 3 | 18 |
| 12 | Recursion & Backtracking | 10 | 5 | 3 | 18 |
| Total | 120 | 60 | 36 | 216 |
If you're starting from scratch, here's the recommended order:
Week 1–2: Arrays & Strings → Hash Tables & Sets → Two Pointers & Sliding Window
Week 3–4: Linked Lists → Stacks & Queues → Recursion & Backtracking
Week 5–6: Binary Trees → Binary Search Trees → Heaps & Priority Queues
Week 7–8: Graphs → Sorting & Searching → Dynamic Programming
Each week: solve Easy problems first, then revisit with Medium. Save Hard problems for after you've internalized the core patterns.
| Level | What to Expect | Time Goal |
|---|---|---|
| Easy | One core concept, straightforward approach | 10–15 min |
| Medium | Combines 2 concepts, requires pattern recognition | 20–35 min |
| Hard | Complex state management, multi-step optimization | 40–60 min |
We welcome contributions of all sizes — from fixing a typo to adding a whole new problem.
See CONTRIBUTING.md for the full guide including the problem file template, code style requirements, and PR process.
Quick start:
- Fork the repo
- Add your problem following the template
- Open a PR with title:
Add: Problem Name (Difficulty) — Category
- Star this repo if it helps you — it helps others find it
- Watch for updates as new problems are added
- Share with anyone preparing for interviews
MIT — see LICENSE. Free to use, share, and build upon.
Built with care by the community, for the community.