npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leet-tui

v0.1.4

Published

A terminal UI for practicing LeetCode Blind 75 problems with embedded Neovim

Readme

LeetCode TUI

A terminal user interface (TUI) application for solving LeetCode problems with an embedded Neovim editor.

Features

  • 149 NeetCode problems: Curated problems from the NeetCode 150 list with full test suites
  • Multi-language support: JavaScript, Python, C, and C++
  • Two test modes:
    • Run (Ctrl+R): Quick validation with 3-5 test cases
    • Submit (Ctrl+S): Full validation with 50-200 test cases
  • Complexity analysis: Automatic time/space complexity estimation after passing tests
  • Split-screen interface: 1/3 for problem description, 2/3 for Neovim editor
  • Embedded Neovim: Full Neovim functionality within the TUI
  • Scrollable results modal: Navigate through test output with keyboard
  • Color-coded results: PASSED in green, FAILED in red
  • Organized solution files: Solutions saved to ~/.local/share/leet-tui/solutions/

Test Output

Run Mode (Ctrl+R)

Verbose output showing each test case with input/output:

Test 1: PASSED [0.05 ms]
  Input:    [2,7,11,15], 9
  Output:   [0,1]

Test 2: PASSED [0.03 ms]
  Input:    [3,2,4], 6
  Output:   [1,2]

Submit Mode (Ctrl+S)

Compact table format for large test suites:

+-------+--------+--------------+
| Test  | Status |     Time     |
+-------+--------+--------------+
|   1   |   ✓    |     0.05 ms  |
|   2   |   ✓    |     0.03 ms  |
|   3   |   ✗    |     0.02 ms  |
+-------+--------+--------------+

Results: 2 passed, 1 failed of 3 tests

Complexity Analysis

After all tests pass, benchmarks run with statistical analysis:

Warming up JIT compiler...
Running benchmarks (5 rounds each, taking median)...

+-------------+------------------+------------+--------------+
|      n      |   Median Time    |    Runs    |   Std Dev    |
+-------------+------------------+------------+--------------+
|       10000 |          0.15 ms |       6640 |         1.2% |
|      100000 |          1.52 ms |        660 |         0.8% |
|     1000000 |         15.21 ms |         66 |         2.1% |
+-------------+------------------+------------+--------------+

Time Complexity:  O(n) (slope: 1.00)
Space Complexity: O(n) estimated

Note: Std Dev < 5% indicates stable results

Installation

Via npm (recommended)

npm install -g leet-tui

This installs leet-tui globally and adds it to your PATH. Run from anywhere:

leet-tui

Via Cargo

cargo install leet-tui

This installs the binary to ~/.cargo/bin/ (make sure it's in your PATH).

From source

Prerequisites:

  • Rust (1.70+)
  • Neovim installed and available in PATH
  • For JavaScript: Bun or Node.js
  • For Python: Python 3.x
  • For C/C++: GCC or Clang
git clone https://github.com/trevor-ofarrell/leet-tui
cd leet-tui
cargo build --release

Then either run directly:

./target/release/leet-tui

Or install globally:

cargo install --path .

Usage

Once installed globally, run from any directory:

leet-tui

Solutions are saved to ~/.local/share/leet-tui/solutions/ organized by language.

Keyboard Shortcuts

Global

  • Ctrl+C: Quit application

Home Page

Problem List (default focus)

  • Up/Down: Navigate problem list (circular)
  • Enter: Open selected problem
  • L: Cycle language (JS → Python → C → C++)
  • /: Jump to search box

Navigation

  • Tab: Cycle focus forward (List → Search → List Filter → Category → Difficulty → Progress)
  • Shift+Tab: Cycle focus backward

Search Box

  • Type: Filter problems by title or number
  • Enter: Return to problem list
  • Esc: Clear search and return to problem list

Filters (List, Category, Difficulty, Progress)

  • Left/Right: Cycle through filter options (circular)
  • Enter: Return to problem list

Question View

Editor Pane (default focus)

  • All Neovim shortcuts: Full Neovim functionality
  • Ctrl+R: Run tests (quick mode, 3-5 cases)
  • Ctrl+S: Submit tests (full mode, 50-200 cases)
  • Ctrl+Q: Switch focus to question pane
  • Ctrl+T: Toggle tips visibility
  • Ctrl+H: Back to home page

Question Pane

  • Up/Down: Scroll question text
  • PageUp/PageDown: Fast scroll (10 lines)
  • Home: Jump to top
  • Shift+R: Reset solution to template
  • Ctrl+Q: Switch focus to editor pane

Results Modal

  • Esc: Close modal
  • Up/Down or j/k: Scroll results
  • PageUp/PageDown: Fast scroll (10 lines)
  • Home/End or g/G: Jump to top/bottom

Architecture

The application uses:

  • ratatui: Terminal UI framework
  • portable-pty: PTY system for spawning Neovim
  • vt100: Terminal emulator parser
  • tui-term: Widget for rendering terminal output
  • crossterm: Cross-platform terminal manipulation
  • rust-embed: Embedded problem data and test cases

Project Structure

src/
├── main.rs       # Main application logic and UI rendering
├── pty.rs        # PTY manager for Neovim integration
├── input.rs      # Keyboard input handling
├── leetcode.rs   # Problem data and test runner generation
└── language.rs   # Multi-language support

problems/         # Embedded problem definitions (JSON)
testcases/        # Extended test cases for run/submit modes

Benchmarking Methodology

The complexity analysis uses robust benchmarking practices:

  1. Aggressive warmup: 500 iterations across multiple input sizes to stabilize JIT
  2. Multiple rounds: 5 benchmark rounds per size
  3. Median selection: Uses median instead of mean to filter outliers
  4. Statistical reporting: Shows relative standard deviation for confidence
  5. GC management: Forces garbage collection between rounds

This produces repeatable results - look for Std Dev < 5% to confirm stability.

Supported Languages

| Language | Runtime | File Extension | |----------|---------|----------------| | JavaScript | Bun (preferred) or Node.js | .js | | Python | Python 3.x | .py | | C | GCC/Clang | .c | | C++ | G++/Clang++ | .cpp |

Troubleshooting

Keys not working in Neovim

If certain key combinations don't work, you may need to add them to the key_to_bytes function in src/input.rs.

Terminal size issues

The application handles resize events and updates the PTY size accordingly. If you experience rendering issues, try resizing your terminal.

Inconsistent benchmark results

If Std Dev is high (>10%), try:

  • Closing other applications
  • Running on a less loaded system
  • The median should still be reasonably stable

Test runner errors

Ensure the appropriate runtime is installed:

  • JavaScript: bun --version or node --version
  • Python: python3 --version
  • C/C++: gcc --version or clang --version

License

MIT