This repository contains solutions to LeetCode problems written in TypeScript. Each solution is accompanied by tests to ensure correctness.
leetcode/
│
├── src/ # Source code
│ ├── problems/ # LeetCode problem solutions
│ │ ├── problem1.ts # Example: Two Sum
│ │ ├── problem2.ts # Example: Reverse String
│ │ └── ... # Other solutions
│ ├── utils/ # Utility functions (if any)
│ └── index.ts # Entry point (optional)
│
├── tests/ # Test cases
│ ├── problem1.test.ts # Tests for Two Sum
│ ├── problem2.test.ts # Tests for Reverse String
│ └── ... # Other tests
│
├── .gitignore # Ignored files
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
- Ensure you have Node.js installed (recommended version 18+).
- Clone the repository:
git clone git@github.com:Nikxxx007/LeetCode.git cd leetcode - Install dependencies:
npm install
You can execute any solution using ts-node:
npx ts-node src/problems/problem1.tsThe project uses Jest for testing. To run tests, use the following command:
npm test- Create a new file in
src/problems/, e.g.,problemX.ts. - Implement the solution inside this file.
- Create tests in
tests/problemX.test.ts. - Run tests to ensure correctness.
npm test- Run Jest tests
This project is licensed under the MIT License.