I Built a LeetCode CLI That Tracks Your Solve Time and Saves Solution Versions

Published: (January 13, 2026 at 01:53 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

The Problem

If you’ve ever grinded LeetCode, you know the pain:

  • Constantly switching between browser and editor
  • No way to track how long problems actually take you
  • Losing your brute‑force solution after optimizing
  • No timer to simulate real interview pressure

I solved all of this by building leetcode‑cli — a full LeetCode workflow that runs entirely in your terminal.

Features

CLI Commands

# List problems (filter by difficulty)
leetcode list -d medium

# View a problem
leetcode show 1

# Generate a solution file
leetcode pick 1

# Test locally
leetcode test 1

# Submit to LeetCode
leetcode submit 1

File Organization

leetcode/
├── Easy/
│   └── Array/
│       └── 1.two-sum.java
└── Medium/
    └── String/
        └── 3.longest-substring.java

Timer

# Default timers (Easy: 20 min, Medium: 40 min, Hard: 60 min)
leetcode timer 1

# Custom timer (30 minutes)
leetcode timer 1 -m 30

# View solve‑time history
leetcode timer --stats

The timer records each session so you can measure improvement over weeks.

Snapshots

# Save a version
leetcode snapshot save 1 "brute-force"

# ...optimize your solution...

leetcode snapshot save 1 "optimized"

# Compare two snapshots
leetcode snapshot diff 1 1 2

# Restore a previous version
leetcode snapshot restore 1 brute-force

Never lose a working solution again.

Collaboration

# Person 1 creates a room
leetcode collab host 1   # → room code: ABC123

# Person 2 joins
leetcode collab join ABC123

# Both solve, then compare
leetcode collab compare

Great for mock interviews with friends.

Workspaces

# Create separate contexts
leetcode workspace create interview -w ~/lc-interview
leetcode workspace create daily -w ~/lc-daily

# Switch to a workspace
leetcode workspace use interview

Each workspace has its own config, timer history, and snapshots.

GitHub Sync

# Set remote repository
leetcode config --repo https://github.com/you/leetcode-solutions.git

# Push local changes
leetcode sync

Installation

# Via npm
npm install -g @night-slayer18/leetcode-cli

Or with Docker:

docker pull nightslayer/leetcode-cli:latest

Quick Start

# Log in (paste your LeetCode cookies)
leetcode login

# Get today's challenge
leetcode daily

# Start solving problem #1
leetcode pick 1

Resources

  • GitHub:
  • npm:
  • Documentation:

If this helps your LeetCode grind, consider giving the repo a ⭐ and share any feature ideas in the comments!

Back to Blog

Related posts

Read more »

2026: The Year of Java in the Terminal

Article URL: https://xam.dk/blog/lets-make-2026-the-year-of-java-in-the-terminal/ Comments URL: https://news.ycombinator.com/item?id=46445229 Points: 39 Comment...

2026: The Year of Java in the Terminal?

Article URL: https://xam.dk/blog/lets-make-2026-the-year-of-java-in-the-terminal/ Comments URL: https://news.ycombinator.com/item?id=46445229 Points: 51 Comment...