This repository contains solutions to common algorithm problems implemented in Node.js, along with unit tests to verify their correctness. Jest is used as the testing framework.
-
Daily:
- Solve 1-2 algorithm problems.
- Review related sections in the cheat sheet.
-
Weekly:
- Review the entire cheat sheet.
- Identify weak areas and plan focused practice for the next week.
Ensure you have Node.js installed. Download it from nodejs.org.
- Clone the repository:
git clone https://github.com/rupeshtiwari/algo-practice.git cd algo-practice
- Install dependencies:
npm install
algo-practice/
├── node_modules/
├── src/
│ └── twoSum.js # Algorithm implementations
├── tests/
│ └── twoSum.test.js # Unit tests for the algorithms
├── docs/
│ └── twoSum.md # Detailed explanations and documentation
├── package.json # Project configuration and dependencies
├── package-lock.json # Dependency tree lock file
└── README.md # Project overview and setup instructions
To execute the unit tests, run:
npm test
- Create a new JavaScript file in the
src
directory:touch src/newAlgorithm.js
- Implement your algorithm in the new file.
- Create a corresponding test file in the
tests
directory:touch tests/newAlgorithm.test.js
- Write test cases for your algorithm in the test file.
For detailed explanations and documentation, visit the docs.
Fork the repository and create a pull request with your changes. Ensure you add corresponding test cases for any new algorithms you implement.
This project is licensed under the MIT License - see the LICENSE file for details.
Happy coding!