Skip to content

batuergun/leetcode-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode CLI

LeetCode CLI is a Go-based command-line tool designed to fetch LeetCode problem details listed in a README.md file and save them locally. It utilizes the LeetCode API to retrieve problem information and stores it in a structured format.

Features

  • Parses a README.md file to extract problem slugs.
  • Fetches problem details from the LeetCode API.
  • Saves problem details in a local directory structure.
  • Skips problems that are marked as "paid only".

Installation

  1. Install the tool using go install:
go install github.com/batuergun/leetcode-cli@latest
  1. Ensure your GOPATH/bin is in your PATH environment variable. You can add the following line to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export PATH=$PATH:$GOPATH/bin

Then, reload your shell profile:

source ~/.bashrc

Usage

  1. Ensure your README.md file is formatted correctly with problem slugs. Example:
## LeetCode Archive

- [x] 1.Two Sum
- [ ] 2.Add Two Numbers
- [ ] 3.Longest Substring Without Repeating Characters
- [x] 4.Median of Two Sorted Arrays
  1. Run the CLI tool:
leetcode-cli <README.md>
  1. The tool will fetch the specified problems and save their details in the problems directory.

Example

Given the following README.md:

## LeetCode Archive

- [x] 1.Two Sum
- [ ] 2.Add Two Numbers
- [ ] 3.Longest Substring Without Repeating Characters
- [x] 4.Median of Two Sorted Arrays

The tool will fetch details for "Add Two Numbers" and "Longest Substring Without Repeating Characters" and save them in the problems directory.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

The MIT License (MIT) - See the LICENSE for more details

About

Go-based command line tool to fetch LeetCode problems and save locally.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages