
LeetCode in Go
Go solutions to LeetCode problems, with tests and a companion online and PDF cookbook.halfrost/LeetCode-Go
- Stars
- 33.8k
- Forks
- 5.7k
- Licence
- MIT
- Language
- Go
- Last update
- 24 days ago
- Type
- Learning resource
What it is
This is a collection of Go code solutions to LeetCode algorithm problems, organized by data structure and algorithm topic. The README says the solutions follow the Google Go Style Guide and that the project reports 100% test coverage. It also publishes the material as an e-book, the LeetCode Cookbook, available online and as a PDF.
- Read a solution to a LeetCode problem and compare it with your own approach
- Run the included tests to check a solution's behavior
- Study the topic index (arrays, dynamic programming, trees, and so on) to find problems by technique
- Read the Cookbook e-book online or as a PDF
Great for
- Developers practicing LeetCode problems in Go
- Engineers preparing for technical interviews who want to compare their approach with worked solutions
- Students learning Go through algorithm code
- Readers who want topic-by-topic explanations alongside code
Not ideal for
- Complete beginners to programming, since the README assumes familiarity with algorithms and data structures
- People who want solutions in languages other than Go, since this repo is Go-only
- Anyone wanting a tool or application to run, since this is a set of solution code and reading material
How to get it
- 1
Clone and build from source
You'll need: Go
Clone the repository
git clone https://github.com/halfrost/LeetCode-Go.git - 2
Run it
- Clone the repository and open it in a Go-capable editor
- Browse the topic list in the README to find a problem or data structure
- Open the solution file for a problem and read the code
- Run the Go tests in the repository to see the solution's test results
- 3
Get the most out of it
- Read the Cookbook alongside the code, either online at books.halfrost.com/leetcode or as the offline PDF from the releases page
- Use the topic index to study one technique, such as dynamic programming or sliding window, at a time
- Read the Chinese version (README_zh.md) if you prefer that language, since the README links to it
Downloads
Strengths
- The README states the code follows the Google Go Style Guide
- The README reports 100% test coverage and a Go test status badge
- Organized by data structure and algorithm topic, with the Cookbook as companion reading
Trade-offs
- The README is truncated in this record, so the full list of solved problems and their completeness is not confirmed here
- Some topic sections are marked as still having unsolved problems, per the README's checkmark note
- Coverage and runtime claims come from badges in the README and were not independently verified
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| LeetCode-Go (this) | 33.8k | Learning resource | beginner | 24 days ago | Developers practicing LeetCode problems in Go |
| interviews | 65.5k | Learning resource | beginner | 1.5 years ago | Students preparing for their first software engineering interviews |
| algorithm-pattern | 15.5k | Learning resource | beginner | 5 months ago | People preparing for coding interviews who want to study by topic |
| tech-interview-handbook | 143k | Learning resource | beginner | 3 months ago | Engineers preparing for technical interviews who have limited study time |
| The-Complete-FAANG-Preparation | 12.3k | Learning resource | beginner | 25 days ago | Students preparing for technical software engineering interviews |
| algorithm-base | 10.7k | Learning resource | beginner | 1.5 years ago | Chinese-speaking developers preparing for coding interviews |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.