Skip to content

phantompunk/kata

Repository files navigation

Kata 🥋

Kata a command-line companion for LeetCode that helps you practice coding problems using TTD.

kata

Why Kata?

It brings LeetCode practice to your terminal supporting a TDD-first approach. Use your environment, write your tests, submit your solutions, train on the same problems to build muscle memory.

Installation

via cURL (macOS/Linux)

curl -LsSf https://raw.githubusercontent.com/phantompunk/kata/main/scripts/install.sh | sh

Review script: install.sh before running.

via Powershell (Windows)

irm https://raw.githubusercontent.com/phantompunk/kata/main/scripts/install.ps1 | iex

Review script: install.ps1 before running.

Go

go install github.com/phantompunk/kata@latest

Build (requires Go 1.24+)

git clone https://github.com/phantompunk/kata.git
cd kata
go build

Quick Start

# Download and stub a problem
kata get two-sum

# Add your solution
vim ~/katas/two_sum/two_sum.go

# Test your solution
kata test two-sum

# See your progress
kata list

Usage

Download Problems

# Stub problem using id
kata get 15

# Stub problem using slug
kata get 3sum     

# Specify language
kata get 3sum --language python

# Open immediately in editor
kata get 3sum -l python --open

# Refresh problem stubs
kata get 3sum --force

Test Solutions

Test your solutions against LeetCode's servers:

# Test using default language
kata test 3sum

# Test using specific language
kata test 3sum --language

!Note: Testing against LeetCode requires authentication

Submit Solutions

Submit your solutions to LeetCode's servers:

# Submit using default language
kata submit 3sum

# Submit using specific language
kata submit 3sum --language

!Note: Testing against LeetCode requires authentication

Track Progress

View your completed problems:

kata list

Authentication

Need to authenticate to test or submit against LeetCode servers.

# Login using browser cookies (automatically extracts session data)
kata login

Quiz Mode

Get a random problem to solve:

kata quiz

Configuration

Open settings in your editor:

kata settings

Config File

# default language
language: go
# open file
openInEditor: false
# track progress for langauges
tracks:
- Go
- Python
# useful for debugging
verbose: false
# workspace for kata files
workspace: ~/Workspace/katas

Contributing

See contributing.

License

MIT License - see LICENSE file for details.


Happy coding! Practice makes permanent. 🥋

About

Command-line companion for practicing Leetcode problems

Topics

Resources

License

Stars

Watchers

Forks