Repository for practicing LeetCode problems in Go with standardized structure, CI checks, and pre-commit automation.
- repo root: Go module root.
problems/<0001-0300>/: range folders (300 problems each).problems/<range>/p<id>/solution_<id>.go: solution implementation.problems/<range>/p<id>/solution_<id>_test.go: solution tests.util/constants.go: shared constants.util/helpers.go: shared helper functions.util/types.go: shared types..github/workflows/ci.yml: CI pipeline.scripts/new_solution.sh: Creates standardized solution stubs.scripts/validate_solutions.sh: Validates per-problem layout and package conventions..pre-commit-config.yaml: Local pre-commit checks.
- Go version:
1.26(go.mod). - Each solution lives in:
problems/<range>/p<problem_id>/solution_<problem_id>.go
- Each test lives alongside the solution in the same
p<problem_id>directory. - Package name must match the problem directory:
- directory
p382usespackage p382
- directory
- Shared helpers/types/constants live under:
util
make fmt
make fmt-check
make validate
make test
make verifymake verify runs format checks, solution validation, and tests across all ranges.
Create a new solution stub:
./scripts/new_solution.sh 1234Install once:
~/.venv/py3_11/bin/pre-commit installRun manually:
~/.venv/py3_11/bin/pre-commit run --all-filesGitHub Actions runs on every push/PR:
- format + structure validation
- tests
- lint (
golangci-lint v2)
For this repo, "CD" is continuous delivery of quality gates to main (no deployment target yet).
- CI pins Go to
1.26.xin.github/workflows/ci.yml. - Lint workflow uses
golangci-lint-action@v9withgolangci-lint v2. scripts/validate_solutions.shsupports bothrgandgrep, so it works on runners withoutripgrep.