Skip to content

Python LeetCode practice environment with automated problem generation, data structure visualizations, and comprehensive testing. Includes all Grind 75, partial Blind, Neetcode and Algomaster problems with enhanced TreeNode/ListNode helpers, CI/CD pipeline, and LLM-assisted problem creation.

License

Notifications You must be signed in to change notification settings

wislertt/leetcode-py

Repository files navigation

LeetCode Practice Repository πŸš€

Quality Gate Status Security Rating Vulnerabilities codecov tests release

Premium LeetCode practice environment with modern Python tooling, beautiful tree visualizations, and comprehensive testing.

✨ Features

  • Template-driven development - Consistent structure for every problem
  • Beautiful visualizations - TreeNode with anytree/Graphviz, ListNode with arrows
  • Interactive notebooks - Multi-cell playground for each problem
  • One-command testing - make p-test PROBLEM=problem_name
  • Bulk regeneration - make gen-all-problems from JSON templates
  • Full linting - black, isort, ruff, mypy with nbqa for notebooks
  • Modern Python - PEP 585/604 syntax with full type hints

πŸš€ Quick Start

# Run existing problems
make p-test PROBLEM=insert_interval
make p-test PROBLEM=invert_binary_tree

# Run all tests
make test

Adding new problems:

  • Copy problem and placeholder solution from LeetCode
  • Ask LLM to generate them
  • LLM follows workflow in .amazonq/rules/problem-creation.md using cookiecutter templates

🧰 Commands

make p-test PROBLEM=insert_interval     # Test specific problem
make test                               # Run all tests
make lint                               # Code quality checks
make p-gen PROBLEM=new_prob             # Generate new problem

🍴 Fork Setup:

make gen-all-problems                   # Regenerate all problems from JSON templates

🧰 Helper Classes

  • TreeNode: from leetcode_py.tree_node import TreeNode
    • Beautiful tree visualization with anytree rendering
    • Jupyter notebook support with Graphviz diagrams
    • Easy array ↔ tree conversion for testing
  • ListNode: from leetcode_py.list_node import ListNode
    • Clean arrow visualization (1 -> 2 -> 3)
    • Simple array ↔ list conversion
    • Perfect for debugging linked list problems
  • New helpers: Add to leetcode_py/

Perfect for interview preparation with professional-grade tooling and beautiful visualizations.

About

Python LeetCode practice environment with automated problem generation, data structure visualizations, and comprehensive testing. Includes all Grind 75, partial Blind, Neetcode and Algomaster problems with enhanced TreeNode/ListNode helpers, CI/CD pipeline, and LLM-assisted problem creation.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Languages