Repolode
j178

j178/leetgo

A command-line tool for LeetCode that generates solution skeletons and test cases, runs tests locally, and handles contest questions and submissions.

Stars
710
Forks
54
Open issues
13
Last commit
14 days ago

What is it?

leetgo lets you work through LeetCode problems entirely from the terminal. For a chosen question it generates the problem description, skeleton code and test case files in your preferred language, so you can edit and debug in any IDE.

For supported languages, leetgo runs your solution against the local test cases and compares the output, which makes it possible to step through code with a debugger. It can also generate contest questions as they open, let you solve them in batch, and submit all of them at once. Questions can be selected by slug, id, daily challenge, or contest position such as weekly100/1.

The tool works with both leetcode.com and leetcode.cn. Credentials can be read from a browser, provided as cookies, or supplied through environment variables, and code templates and modifiers can be customized in leetgo.yaml.

Key features

  • 01Generates problem descriptions, skeleton code and test files for a question.
  • 02Runs test cases locally for Go, Python, C++ and Rust.
  • 03Generates contest questions as they open and submits them in one batch.
  • 04Supports both leetcode.com and leetcode.cn.
  • 05Reads browser cookies automatically or accepts credentials via environment variables.
  • 06Includes an interactive question picker with filters and Markdown preview.

Use cases

  • Practicing LeetCode daily from the terminal with your own editor.
  • Debugging a failing solution locally with a debugger before submitting.
  • Competing in weekly or biweekly contests and submitting all answers at once.

Quick start

  1. 1

    Install leetgo via Homebrew on macOS/Linux

    brew install leetgo
  2. 2

    Initialize leetgo with site and language

    leetgo init -t <us or cn> -l <lang>
  3. 3

    Pick a question

    leetgo pick <id or name or today>
  4. 4

    Test your code locally

    leetgo test last -L

Things to know

  • Local testing is only supported for Go, Python, C++ and Rust.
  • Submitting and fetching questions requires LeetCode cookies or credentials.

In collections

Topics

FAQ

What is leetgo?
A command-line tool for LeetCode that generates solution skeletons and test cases, runs tests locally, and handles contest questions and submissions. leetgo lets you work through LeetCode problems entirely from the terminal. For a chosen question it generates the problem description, skeleton code and test case files in your preferred language, so you can edit and debug in any IDE.
Is leetgo free to use? What license does it have?
leetgo is open source under the MIT license. Check the license terms before using it in commercial products.
Is leetgo still maintained?
Actively maintained. The last commit to leetgo was on Oct 25, 2026.
What can I use leetgo for?
Practicing LeetCode daily from the terminal with your own editor. Debugging a failing solution locally with a debugger before submitting. Competing in weekly or biweekly contests and submitting all answers at once.
How do I install leetgo?
Install leetgo via Homebrew on macOS/Linux: brew install leetgo Initialize leetgo with site and language: leetgo init -t <us or cn> -l <lang> Pick a question: leetgo pick <id or name or today> Test your code locally: leetgo test last -L
Where can I get leetgo?
The source code and installation instructions are on GitHub: https://github.com/j178/leetgo

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects