Open-source project
halfrost/LeetCode-Go avatar
halfrost/LeetCode-Go

LeetCode-Go: A Go-First Algorithm Cookbook with a Data Structure Syllabus

Solutions to LeetCode by Go, 100% test coverage, runtime beats 100%.

33,810 stars5,682 forksGoMIT

At a glance

What is it?
halfrost/LeetCode-Go is a Go solution repository that pairs LeetCode problems with a structured data structure and algorithm syllabus. Its real value is not the code alone but the linked e-book and the explicit coverage map.
Who is it for?
Adopt LeetCode-Go if you are a Go developer preparing for interviews and want solutions that follow the Google Go style guide, with a companion e-book that maps problems to data structures. Skip it if you need explanations in languages other than English or Chinese, or if you prefer video walkthroughs.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 34 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • halfrost/LeetCode-Go33,810 ★ · +17
Star history
Repository2026-08-182026-11-15
halfrost/LeetCode-Go33.8k33.8k

17 Stars in the last 89 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What This Repository Actually Solves

This repo provides solutions in Go, with a stated adherence to the Google Golang Style Guide. That is a concrete constraint, not a marketing line. The target user is someone who already knows Go and wants to see how common algorithms are expressed in that language. It also bundles a companion e-book, the LeetCode Cookbook, which is available online as a Progressive Web App and as an offline PDF. So the deliverable is not just a code dump; it is a study package that ties problems to a data structure syllabus.

How the Repository Is Organized

The README groups problems by data structure and algorithm. You see a list of topics like Array, String, Two Pointers, Linked List, Stack, Tree, Dynamic Programming, and others. Topics marked with a checkmark have all their problems completed, while unmarked ones still have gaps. That is an honest signal: not every topic is fully covered. The README also includes a large table that maps data structures to variants and related concepts. For example, strings are linked to KMP, finite-state automaton, and Boyer-Moore. This is a syllabus, not just a list of links. The claim of 100% test coverage is prominent, and the repository has a Codecov badge, which suggests the test suite is tracked.

Getting It Running: Commands and Setup

The repository is a standard Go module. To use it locally, you would clone the repo and run tests with the Go toolchain. A typical workflow is: git clone https://github.com/halfrost/LeetCode-Go.git, then cd LeetCode-Go, and run go test ./... to execute the test suite. The repository has a GitHub Actions workflow named test.yml, which likely runs these tests on each push. For a specific problem, you would navigate to the corresponding folder and run go test on that package. The e-book is available at books.halfrost.com/leetcode, and you can install the PWA from a mobile browser. The offline PDF edition is available from the releases page; the latest release is 1.7.97 from June 2026. So the setup is minimal: Go installed, clone, test.

The 100% Coverage Claim and What It Means

The repository description says '100% test coverage, runtime beats 100%'. That is a bold claim. The Codecov badge suggests coverage is tracked, but the runtime claim is harder to verify. It likely refers to LeetCode's own runtime percentile, not a guarantee that every solution is optimal in every environment. As a reader, you should treat the coverage claim as a test-coverage metric, not a proof of correctness for all edge cases. The repository has a test workflow, which is a good sign, but coverage percentage does not equal absence of bugs. For interview preparation, passing the provided tests is necessary but not sufficient. You should still reason through the algorithm yourself.

Limitations and When It Is the Wrong Tool

The most obvious limitation is language. The README is in English, with a Chinese version (README_zh.md) available. If you need explanations in another language, this repo is not for you. Second, not all topics are complete. The README marks only certain data structures as fully solved: Two Pointers, Linked List, Stack, Backtracking, Sort, Bit Manipulation, Union Find, Sliding Window, Segment Tree, and Binary Indexed Tree. Others like Array, String, Tree, Dynamic Programming, DFS, BFS, Binary Search, Math, and Hash Table are not marked complete. That means you cannot rely on this repo as a comprehensive reference for those topics. Third, the solutions follow a specific style guide, which is good for consistency but may not match the style of your target company. If you are not a Go developer, this repo is irrelevant. It is also not a teaching tool for absolute beginners; it assumes you already know the algorithms and just need Go implementations.

Alternatives and How They Differ

A common alternative is a multi-language LeetCode solutions repository. The difference is in the approach: LeetCode-Go is Go-only and pairs with a data structure and algorithm syllabus, while the multi-language repos focus on breadth of language coverage. Another alternative is the official LeetCode discussion forums, which offer many solutions per problem but without a consistent style guide or a curated structure. If you need a structured learning path, LeetCode-Go's e-book is the differentiator. If you need to switch languages frequently, a multi-language repo is more practical.

Maintenance, Licensing, and Upgrade Cost

The repository is actively maintained. The last push was October 12, 2026, and the latest release is 1.7.97 from June 28, 2026. The release cadence is irregular: there was a jump from 1.7.0 in June 2021 to 1.7.97 in June 2026, indicating a long period of incremental updates. The license is MIT, which means you can use the code freely, even in commercial projects, with attribution. There is no cost to upgrade; you can simply pull the latest changes. The main maintenance cost is for the maintainer, not the user. For a user, the cost is time spent browsing the repo and cross-referencing the e-book. The Go module depends on external libraries such as BurntSushi/toml, spf13/cobra and mozillazg/request. The repository has a deploy workflow, which likely publishes the e-book automatically.

Editorial conclusion

Adopt LeetCode-Go if you are a Go developer preparing for interviews and want solutions that follow the Google Go style guide, with a companion e-book that maps problems to data structures. Skip it if you need explanations in languages other than English or Chinese, or if you prefer video walkthroughs. Before relying on it, verify that the solutions for the specific problems you care about are complete, since not all topics are marked as fully solved. Then check the test files for those problems to confirm the 100% coverage claim holds for your target set. The repository is actively maintained, with a release as recent as June 2026, so the coverage map is likely current, but always spot-check.

Frequently asked questions

What is halfrost/LeetCode-Go?

It is a repository of solutions to LeetCode problems written in Go, with the code style strictly following the Google Golang Style Guide, plus a data structures library and the LeetCode Cookbook e-book. The cookbook is available as an online reading edition with progressive web app and dark mode support, as an offline PDF from the releases page, and as a PWA you can install to your home screen from an iOS or Android browser.

Which LeetCode topics are finished in LeetCode-Go?

The README marks a topic with a check mark when all of its problems are completed. Ten are marked: Two Pointers, Linked List, Stack, Backtracking, Sort, Bit Manipulation, Union Find, Sliding Window, Segment Tree and Binary Indexed Tree. Array, String, Tree, Dynamic programming, Depth First Search, Breadth First Search, Binary Search, Math and Hash Table are listed without the mark and still have problems left to solve.

Is the 100% test coverage claim in LeetCode-Go real?

The claim is the repository description's own, and the repository is where you would check it: a coverage.txt is checked in at the root, alongside a test workflow, a Codecov badge, a Go Report Card badge and a gotest.sh script for the local run. The coverage file is a snapshot of one run rather than a guarantee about the current tree.

How do I run the LeetCode-Go solutions?

The project is a Go module whose go.mod declares go 1.19 with local replace directives for the structures, template, ctl/util and ctl/models packages. The repository ships gotest.sh at the root as the local counterpart of the CI test run, and the test workflow in .github/ is the automated version.

What is the LeetCode Cookbook and how often does it update?

It is the e-book built from the same solutions, and the release tags track its editions: 1.7.97 was published on 2026-06-28, after 1.7.0 from 2021-06-20 and 1.6.6 from 2021-02-15. The markdown source for the PDF edition is checked into the repository root as a file named PDF v1.7.97.md.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/halfrost-leetcode-go.svg)](https://hysenlabs.com/projects/halfrost-leetcode-go)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/halfrost-leetcode-go.svg)](https://hysenlabs.com/projects/halfrost-leetcode-go)

Was this useful?