What lcpy gen creates, what each file is for, and which one you own.
Every generated problem is the same six files. Learn the shape once and every
problem in the catalog feels like home.
lcpy gen -n 1
leetcode/two_sum/├── README.md # problem statement, difficulty, topics, tags├── solution.py # your code; the only file you edit├── test_solution.py # 10+ parametrized cases, ready to run├── helpers.py # run_/assert_ pair for readable test output├── playground.py # percent-format scratchpad notebook└── __init__.py
The problem statement: difficulty, topics, collection tags, a link to the
original LeetCode problem, the description, and worked examples. Everything
you need to solve without leaving the terminal.
Generated with a class skeleton, the method signature with type hints, and a
TODO where your implementation goes. Solved examples in this repo also
carry Time/Space complexity comments at the top of the method, the
house convention.
A parametrized pytest suite with 10+ cases per problem, edge cases included.
It runs red the moment you generate the problem and stays the contract: make
red go green, never edit the tests. See Testing.
Two functions per problem: run_<name> instantiates your solution class and
calls the method; assert_<name> compares result to expected, normalized
so order-insensitive answers compare cleanly. Failures print the inputs and
expected output instead of a raw object dump.
Every problem directory comes from a JSON template, so files arrive
byte-identical on every machine and CI verifies they regenerate exactly.
If something looks off, regenerate the problem with bake p-gen rather
than editing generated files by hand.