Clean Data Structures and Algorithms (DSA) solutions in TypeScript — the complete Blind 75, organized by pattern, every problem with a Big-O analysis and Vitest tests. Built for coding interview and LeetCode prep.
DSA in TypeScript is a structured, interview-focused collection of Data Structures & Algorithms solutions written in modern TypeScript. Every problem is grouped by the pattern it teaches (Two Pointers, Sliding Window, Binary Search, Trees, Graphs, Dynamic Programming, and more), and each solution ships with a problem description, worked examples, an approach write-up, time/space complexity, and passing unit tests. If you're grinding LeetCode, working through the Blind 75 / NeetCode 150, or following a Grind 75 style plan and prefer TypeScript / JavaScript over Python or C++, this repo is for you.
Topics: dsa · typescript · algorithms · data-structures · leetcode · blind-75 · grind-75 · neetcode · coding-interview · interview-prep
- Engineers preparing for a coding interview who want idiomatic TypeScript references instead of Python.
- Anyone working through Blind 75, NeetCode 150, or a Grind 75 roadmap and wanting tested, readable solutions.
- Learners who want each DSA problem tied to a reusable pattern with a clear Big-O breakdown.
npm install # install dev deps (typescript, vitest)
npm test # run every test once
npm run test:watch # watch mode
npm run typecheck # type-check without emittingsrc/
lib/ shared helpers (ListNode, TreeNode, builders)
arrays/
two-sum.ts solution + description + Big-O
two-sum.test.ts Vitest tests for that solution
two-pointers/
sliding-window/
...
Each problem lives in its own pattern folder as a pair of files:
<problem>.ts— the solution, headed by a doc comment with the problem link, description, examples, the approach, and time/space complexity.<problem>.test.ts— Vitest cases covering the examples plus edge cases.
Every solution file starts with a header comment shaped like this:
/**
* <Number>. <Title> (<Difficulty>)
* Link: https://leetcode.com/problems/...
*
* <Problem description in a sentence or two.>
*
* Example:
* Input: ...
* Output: ...
*
* Approach:
* <How the solution works, why it is correct.>
*
* Time: O(...)
* Space: O(...)
*/| Pattern | Use it when… | Tell-tale signals | Typical complexity |
|---|---|---|---|
| Arrays / Hashing | You need O(1) lookups, counting, or dedup | "seen before?", frequency, complement | O(n) time / O(n) space |
| Two Pointers | Sorted array/string, pair or partition scanning | "pair sums to X", palindrome, in-place move | O(n) time / O(1) space |
| Sliding Window | Contiguous subarray/substring optimum | "longest/shortest subarray with…", window constraint | O(n) time / O(k) space |
| Fast & Slow Pointers | Cycle detection, middle of list | linked-list cycle, "find the duplicate" | O(n) time / O(1) space |
| Binary Search | Sorted data or a monotonic answer space | "min/max that satisfies…", O(log n) required | O(log n) time |
| Stack | Match/undo/nearest-smaller-or-greater | parentheses, "next greater element", monotonic | O(n) time / O(n) space |
| Heap / Top-K | K largest/smallest, streaming order stats | "top K", "median", scheduling | O(n log k) time |
| Linked List | In-place pointer surgery | reverse, merge, reorder | O(n) time / O(1) space |
| Trees (DFS/BFS) | Hierarchical data, path/level questions | traversal, depth, "level order" | O(n) time / O(h) space |
| Graphs (BFS/DFS) | Connectivity, shortest unweighted path | grids, islands, "can you reach…" | O(V + E) time |
| Backtracking | Enumerate all combinations/permutations | "all subsets", "generate", constraint search | O(branch^depth) |
| Dynamic Programming | Overlapping subproblems + optimal substructure | "number of ways", "min/max cost", "can you…" | O(states × transition) |
| Greedy | Local optimal choice yields global optimum | intervals, scheduling, "minimum number of…" | O(n log n) time |
| Intervals | Overlapping ranges | "merge", "insert", "meeting rooms" | O(n log n) time |
| Tries | Prefix queries over a set of strings | autocomplete, "starts with", word search | O(L) per op |
| Bit Manipulation | Set logic, parity, space-tight state | XOR tricks, masks, "single number" | O(n) time / O(1) space |
Legend — 🟢 Easy · 🟡 Medium · 🔴 Hard
Total solved: 82
✅ Blind 75 complete — the full Blind 75 list is covered in TypeScript (plus a few extra warm-up problems), spanning the same core patterns tested by Grind 75 and NeetCode 150.