May the code be with you.
# Required dependencies: gcc, cmake (to build the bundled sqlite and aws-lc)
cargo install leetcode-cliPython filtering scripts (the --plan flag) require the optional pym feature:
cargo install leetcode-cli --features pymNix users can nix build / nix develop against the bundled flake.nix.
Sign in to LeetCode in Chrome first — on macOS and Linux leetcode-cli reads its cookies automatically (on Windows, set them manually). See Cookies for manual setup and environment-variable overrides.
leetcode pick 1 # pick a problem and print its description
leetcode edit 1 # open the solution file in your editor
leetcode test 1 # run the sample test cases
leetcode exec 1 # submit the solutionRun leetcode --help (or leetcode <command> --help) for the full, always-current list of commands and flags. The headline ones:
Shell completions
By default the shell is inferred from $SHELL:
eval "$(leetcode completions)"Copy that line into .bash_profile or .zshrc. Pass a shell explicitly to target another:
leetcode completions fish- Configuration — the full
leetcode.tomlreference: editor, code generation, filename templates, and storage paths. - Cookies — automatic Chrome cookies, manual setup from any browser,
leetcode.cnsupport, and environment-variable overrides. - Editors & LSP — getting rust-analyzer (and other language servers) working with generated solution files.
- Scripting — filtering problems with custom Python plans.
Feel free to add your name and email to the authors field of Cargo.toml, and open a pull request.
MIT
