This repository contains my personal solutions to various LeetCode problems.
The goal is primarily educational. It serves as a place to store my approaches, track my progress, and document different ways to solve algorithmic problems.
Each problem lives in its own folder, with a solution file and its associated tests.
If you are currently solving problems on LeetCode, please do not use this repository to complete problems without attempting them yourself first.
Solving problems independently is the best way to learn and improve your problem-solving skills.
These solutions are shared:
- π for learning purposes
- π to review different approaches
- π§ to understand alternative implementations
- π as a last resort if you are truly stuck
Please try to solve the problem on your own before reading any solution.
These solutions represent my personal learning process and may not always be the most optimal or idiomatic approach.
LeetCode often has many creative solutions β exploring different implementations is encouraged.
I do not use AI to generate or solve the problem solutions in this repository.
AI is used to generate the test files from the examples provided on the LeetCode problem page. The solution file is never touched.
Extra test cases may also be added by AI when the examples from the problem page don't cover every scenario of the algorithm (e.g. a missing branch or edge case).
For Ruby, this is done via the /write-ruby-test Claude command.
These local tests are only here to help me validate my solutions while working in this repository. They are not necessarily the exact same tests used by LeetCode.
AI is also used to write and maintain the README.md files in this repository.
The repository is grouped by language first, then by problem (identified by its LeetCode number and title slug).
leetcode-solutions/
βββ README.md
βββ ruby/
βββ Gemfile
βββ Gemfile.lock
βββ Makefile
βββ README.md
βββ compose.yaml
βββ 1_two_sum/
βββ main.rb
βββ spec.rb
Each problem folder follows a small and consistent structure:
- one file for the solution
- one file for the tests
Example:
<language>/<number>_<slug>/
βββ solution file
βββ test file
File names may vary depending on the language, but the goal stays the same: keep each problem self-contained and easy to navigate.
Language-specific setup and usage notes are documented in each language folder, for example in ruby/README.md.
Each language lives in its own top-level directory (e.g. ruby/, typescript/) and follows the same conventions.
<language>/
βββ Makefile
βββ compose.yaml
βββ README.md
βββ <number>_<slug>/
βββ main.<ext> # solution file
βββ spec.<ext> # test file
Every language Makefile must expose the same four targets:
| Target | Description |
|---|---|
make up |
Start the Docker container |
make down |
Stop the Docker container |
make shell |
Open a shell inside the container |
make tests <path> |
Run the tests for a given path (directory or file) |
The tests target should accept both a directory (runs all test files found recursively) and a direct path to a single test file.
Each language directory should have its own README.md documenting the setup, how to run tests, and any language-specific notes.
This repository is licensed under the MIT License.