Skip to content

code-guy21/Leetcode-TS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode TypeScript Solutions

A collection of LeetCode problems solved using TypeScript, featuring:

  • 💡 Detailed explanations and approach breakdowns
  • ✅ Comprehensive test coverage
  • 🛠️ Interactive CLI test runner
  • 📝 TypeScript best practices

📚 Contents

🚀 Setup

  1. Clone the repository
git clone https://github.com/code-guy21/Leetcode-TS.git
cd Leetcode-TS
  1. Install dependencies
npm install
  1. Verify setup
npm test

💻 Usage

Interactive CLI

The custom CLI provides an intuitive interface for running tests:

npm start

Features:

  • 📂 Browse problems by category
  • 🧪 Run specific problem tests
  • 📊 View test coverage

Command Line Options

Run all tests:

npm test

Run specific problem tests:

npm test src/tests/arrays/twoSum

Generate coverage report:

npm test -- --coverage

Watch mode:

npm run test:watch

📁 Project Structure

src/
├── arrays/
│   ├── two-sum/
│   │   ├── index.ts         # Solution implementation
│   │   ├── index.test.ts    # Tests
│   │   └── README.md        # Problem explanation
│   └── ...
├── strings/
├── linked-lists/
└── ...

Each problem solution includes:

  • Detailed explanation of the approach
  • Time and space complexity analysis
  • Test cases covering edge cases
  • TypeScript implementation

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch
git checkout -b feature/new-solution
  1. Implement your solution following our template:
    • Add solution in src/tests/category/problem-name/index.ts
    • Add tests in src/tests/category/problem-name/index.test.ts
    • Add README.md with explanation
  2. Commit your changes
  3. Push to the branch
  4. Create a Pull Request

📖 Problem Solutions

Arrays

Sliding Window

Trees

🛠️ Tech Stack

  • TypeScript 5.x
  • Jest for testing

📝 Notes

  • Solutions prioritize readability and maintainability
  • TypeScript features are used to enhance code safety
  • Each solution includes performance considerations
  • Regular updates with new problems and improvements

📄 License

MIT


Don't forget to star ⭐ this repo if you find it helpful!

About

Solutions and explanations for LeetCode problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published