Skip to content

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
Step-by-step guide: how to use LeetCode in GoInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Go

    Clone the repository

    git clone https://github.com/halfrost/LeetCode-Go.git
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
LeetCode-Go (this)33.8kLearning resourcebeginner24 days agoDevelopers practicing LeetCode problems in Go
interviews65.5kLearning resourcebeginner1.5 years agoStudents preparing for their first software engineering interviews
algorithm-pattern15.5kLearning resourcebeginner5 months agoPeople preparing for coding interviews who want to study by topic
tech-interview-handbook143kLearning resourcebeginner3 months agoEngineers preparing for technical interviews who have limited study time
The-Complete-FAANG-Preparation12.3kLearning resourcebeginner25 days agoStudents preparing for technical software engineering interviews
algorithm-base10.7kLearning resourcebeginner1.5 years agoChinese-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.