Welcome to the NeetCode 150 repository! This repository contains solutions and test cases for the NeetCode 150 problems, organized into multiple categories for structured learning. Each problem follows a Test-Driven Development (TDD) approach to help you build strong problem-solving skills in coding.
- ⚡ Quick Feedback: Instantly modify code and get feedback with Bun’s powerful runtime without waiting for long submission results.
- 🆓 Free Debugging: Easily debug your solutions for free using the Bun extension in VSCode.
- 📚 Structured Learning: Focus on problem-solving with 150 handpicked problems, divided into 22 categories, covering various problem types.
-
Clone the repository:
git clone https://github.com/lyn-boyu/neetcode-150.git
-
Switch to the
problems
branch and create your own branch for solutions:git checkout problems && git checkout -b my-solutions
-
Install dependencies and start TDD:
bun install && bun run tdd
The repository is organized into the following problem categories:
01-arrays-hashing 07-trees 13-1d-danamic-programing
02-two-pointers 08-heap-priority-queue 14-2d-danamic-programing
03-sliding-window 09-backtracking 15-greedy
04-stack 10-tries 16-intervals
05-binary-search 11-graphs 17-math-and-geometry
06-linked-list 12-advanced-graphs 18-bit-manipulation
Each category contains multiple problems, and every problem follows this file structure:
problem-name/
│
├── index.ts # Solution file
└── index.test.ts # Test cases for the problem
Example:
contains-duplicate/
│
├── index.ts # Solution file
└── index.test.ts # Test cases
Bun is a modern JavaScript runtime like Node or Deno. It offers a fast and all-in-one solution for running, testing, and bundling JavaScript & TypeScript projects.
To install Bun, run the following command:
curl -fsSL https://bun.sh/install | bash
- Open VSCode.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar or press
Ctrl+Shift+X
(orCmd+Shift+X
on Mac). - Search for "Bun for Visual Studio Code" and install the extension by Oven.
- problems: Contains templates with empty solution functions and test cases.
- solutions: Contains working solutions that pass all test cases.
To start practicing, clone the repository or fork it, then create a new branch from the problems
branch:
git checkout -b my-practice-branch
This will watch for changes and automatically run your tests as you work.
You can easily debug your code using the Bun extension in VSCode:
- Set a breakpoint in
index.ts
by addingdebugger;
. - Switch to
index.test.ts
. - Open the command palette using
Ctrl+Shift+P
(orCmd+Shift+P
on Mac) and select Bun: Debug.
To run the tests and get instant feedback, use the following command:
bun run test
Make sure to commit your changes as you progress through the problems to track your learning journey.
Happy coding! 😄