Skip to content

Solutions developed using Git feature branches and PR-based workflow

License

Notifications You must be signed in to change notification settings

codewithme-py/LeetCode_solutions

Repository files navigation

LeetCode Solutions

My clean, typed, and tested solutions to LeetCode problems (Python 3.10+).

Total: 7
🟢 Easy: 5   ░░░░░░░░░░   (0.5%)
🟡 Medium: 2   ░░░░░░░░░░   (0.1%)
🔴 Hard: 0   ░░░░░░░░░░   (0.0%)

Show all solved problems

Problems

# Title Difficulty Solution
1 Two Sum Easy two_sum_0001.py
2 Add Two Numbers Medium add_two_numbers_0002.py
9 Palindrome Number Easy palindrome_number_0009.py
12 Integer to Roman Medium integer_to_roman_0012.py
13 Roman to Integer Easy roman_to_integer_0013.py
14 Longest Common Prefix Easy longest_common_prefix_0014.py
83 Remove Duplicates from Sorted List Easy remove_duplicates_from_sorted_list_0083.py

Installation guide & description

Этот репозиторий — не просто сборник решений, а готовая среда для практики LeetCode с автоматизацией и профессиональным workflow.

💡 Что получает клонировавший:

  • ✅ Все решения на Python ^3.10 с type hints
  • ✅ Пре-коммит-хук для запуска тестов (pytest) & (ruff)
  • ✅ Автоматическое создание /feat ветки, файлов проблемы и теста
  • ✅ Генерация файлов с контентом: условие задачи, сниппеты кода и примеры тестов (fetch from LeetCode API)
  • ✅ Автообновляемый README.md с прогрессом и ссылками
  • ✅ Интеллектуальное управление кэшем: автоматическое обновление раз в неделю или по требованию
  • ✅ Готовая CI/CD-настройка через GitHub Actions
  • ✅ Чёткая структура: solutions/, tests/, scripts/

⚠️ Для работы скрипта обновления README требуется интернет (запрос к LeetCode 'API' при первом запуске).


Description (EN)

This repo provides a production-grade setup for LeetCode practice:

  • Typed, tested Python 3.10+ solutions
  • Pre-commit hook for running tests (pytest) & (ruff)
  • Automated README generation with progress bars
  • Automated creation of /feat branch, problem and test files
  • Automated generation of files with content: problem statement, code snippets, and test examples (fetch from LeetCode API)
  • Smart cache management: automatic weekly refresh or on-demand
  • Preconfigured CI and CD (auto-update)
  • No manual work — just solve, commit, PR

⚠️ For proper README generation, internet access is required (to query LeetCode 'API' on first run).


🛠 Установка

1. Клонируй репо

git clone https://github.com/codewithme-py/LeetCode_solutions.git
cd LeetCode_solutions

2. Создай и активируй виртуальное окружение

python3 -m venv .venv

Linux/Mac

source .venv/bin/activate

или на Windows

source .venv\Scripts\activate

3. Установи зависимости

pip install -e .[dev]

4. Запусти тесты (проверь, что всё работает)

pytest && ruff check .

5. Используй скрипт обновления README (опционально)

python3 scripts/update_readme.py

Для принудительного обновления кэша задач используйте флаг --force-refresh-cache:

python3 scripts/update_readme.py --force-refresh-cache
  • Кэш задач обновляется автоматически раз в неделю (от даты изменения файла problems_cache.json). Для принудительного обновления кэша задач используйте флаг --force-refresh-cache:

6. Создай токен GitHub и добавь его в Secrets репозитория

  1. https://github.com/settings/tokens → перейди по ссылке
  2. Generate new token (classic) → Note: What’s this token for? → Expiration: your choice → Scopes: repo+workflow → Generate token → Скопируй токен
  3. Repo LeetCode_solutions Settings → Secrets and variables → Actions → New repository secret с именем GH_PAT → Вставь токен → Add secret

7. Используй скрипт → Решай новую задачу → делай push → PR → merge в main → CI/CD сделает всё остальное автоматически!

make problem <номер_задачи>
  1. Скрипт создает новую /feat ветку, а так же файлы решения и тестов минимизируя рутину
  2. Удаление веток после merge опционально (в истории коммитов сохраняется вся инфа)

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •