Skip to content
Feeco-LiPublic

About

A terminal-based interface for browsing, solving, and submitting LeetCode problems

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

54 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Screen Problem Overview

leetui

A terminal-based interface for browsing, solving, and submitting LeetCode problems, built with Rust and Ratatui.

Features

  • Browse all 3000+ problems with instant search and difficulty/status filters
  • Read problem descriptions rendered directly in the terminal
  • Scaffold a Rust project with boilerplate for any problem, then open it in your editor
  • Run & Submit code against LeetCode test cases without leaving the terminal
  • Personal Lists synced with LeetCode -- browse, create, delete, and add problems
  • Stats -- your solve counts right in the home screen
  • Disk cache for instant startup with background refresh
  • Press ? on any screen for all available keybindings

Installation

From crates.io

cargo install leetui

From source

git clone https://github.com/Feeco-Li/leetui.git
cd leetui
cargo install --path .

Shell wrapper (recommended)

When you scaffold a problem with o, the CLI opens your editor inside the problem directory. To auto-cd into that directory after exiting, add this to your ~/.zshrc or ~/.bashrc:

lc() {
  local dir
  dir=$(leetui "$@")
  if [ -n "$dir" ] && [ -d "$dir" ]; then
    cd "$dir"
  fi
}

Then use lc instead of leetui. This is needed because a child process can't change its parent shell's working directory -- the wrapper captures the path printed to stdout and cd's into it.

Without the wrapper everything works the same, you just won't auto-cd after exiting.

Authentication

The CLI reads your LeetCode session cookies directly from your browser (via the rookie crate). No manual token pasting needed.

On first launch you'll be prompted to log in. The app will attempt to extract cookies automatically. If that fails, it will open leetcode.com/accounts/login in your browser -- log in there, then press Enter to retry.

macOS note: Your OS may show a Keychain access prompt. Grant access so the app can read browser cookies.

Controls

Press ? on any screen for the full keybinding reference. Here are the essentials:

Home

Key Action
j / k Navigate
Enter View problem
/ Search
f Filter by difficulty / status
o Scaffold & open in editor
a Add to list
L Browse personal lists
S Settings
q Quit

Problem Detail

Key Action
j / k Scroll
d / u Half page down / up
o Scaffold & open in editor
r Run code (sample cases)
a Add to list
b / q / Esc Back to problem list

r submits your code to LeetCode's servers to run it against the sample cases (same as clicking Run on the website) and opens the result screen. Submitting against all cases, and committing your solution, are both one level deeper -- see below.

Run Result

Key Action
j / k Scroll
s Submit solution (all cases)
b / q / Esc Back to problem detail

Submit Result

Key Action
j / k Scroll
c Git commit & push solution
b / q / Esc Back to run result

q always goes back exactly one step: Submit Result → Run Result → Problem Detail → problem list.

Each testcase is shown as its own block: a pass/fail marker, the input, any print()/debug output, your output, and (if it didn't match) the expected output. Run shows every sample case; Submit only reports the first case that failed, since that's all LeetCode returns. Runtime errors show the full traceback, and accepted submissions show a runtime/memory percentile when LeetCode provides one.

Lists

Key Action
j / k Navigate
l Expand/collapse list
Enter/o Open problem (or expand/collapse a list)
n Create new list
d Delete list / remove problem
q / Esc Back

Lists expand in place -- press l on a list to show its problems indented underneath it, without leaving the lists screen. Navigate through both lists and their problems with j/k, and press Enter or o on a problem to open it directly.

Configuration

Settings are stored in ~/.leetcode-cli/config.toml. You can edit them from within the app by pressing S, or edit the file directly:

  • workspace_dir -- where scaffolded projects are created (default: ~/leetcode)
  • language -- rust or python3 (Note: other languages might appear here, but only Rust and Python are supported/tested)
  • editor -- command to open files (default: nvim)
  • solutions_repo_url -- (optional) git URL of an existing solutions repo. If workspace_dir doesn't exist yet (e.g. on a new device), the first time you scaffold a problem (o) it's cloned there instead of creating an empty directory.

Contributing

This is a hobby project and I'm strictly prioritizing Rust-specific features. That said:

  • Feel free to fork the repo and do whatever you want with it
  • PRs are welcome -- submit directly, no need to open an issue first

Original Creator

This project was originally created by ab7tr4ct (formerly known as yottaes on GitHub). The original repository at https://github.com/yottaes/leetui has been deleted. This repository exists to preserve the source code so the project remains available to anyone who finds it useful.

License

MIT

About

A terminal-based interface for browsing, solving, and submitting LeetCode problems

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages