# halfrost/leetcode-go architecture

> Architecture diagram of the GitHub repository halfrost/leetcode-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/halfrost/leetcode-go
- Repository: https://github.com/halfrost/leetcode-go

## Overview

This repository is primarily a Go reference collection of LeetCode solutions, presented alongside the *LeetCode Cookbook* online/PWA and downloadable PDF editions. A learner can browse a problem’s solution in the collection or study it through the book; the README documents these offerings, but the sampled files do not show a content-generation or web-serving pipeline. The algorithm groups are representative topic areas, not a runtime call sequence. The tree also shows shared tree and segment-tree code; source evidence is limited, so no unverified wiring is asserted.

Main entry points: [`leetcode/0704.Binary-Search/704. Binary Search.go`](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0704.Binary-Search/704.%20Binary%20Search.go) (Search and Arrays), [`leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree.go`](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0098.Validate-Binary-Search-Tree/98.%20Validate%20Binary%20Search%20Tree.go) (Tree Algorithms), [`leetcode/0005.Longest-Palindromic-Substring/5. Longest Palindromic Substring.go`](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0005.Longest-Palindromic-Substring/5.%20Longest%20Palindromic%20Substring.go) (Strings and Windows), [`leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go`](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82.%20Remove%20Duplicates%20from%20Sorted%20List%20II.go) (Lists and Stacks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_solutions["Go Solutions"]
  node_search["Search and Arrays"]
  node_strings["Strings and Windows"]
  node_lists["Lists and Stacks"]
  node_trees["Tree Algorithms"]
  node_graphs["Graph Search<br/>[815. Bus Routes.go]"]
  node_dynamic["Dynamic Programming"]
  node_backtracking["Backtracking<br/>[79. Word Search.go]"]
  node_math["Math and Bits"]
end

subgraph group_shared["Shared Structures"]
  node_tree_types["Tree Types<br/>[TreeNode.go]"]
  node_segment_tree["Segment Tree<br/>[SegmentTree.go]"]
end

subgraph group_book["Cookbook Editions"]
  node_cookbook["Online Cookbook"]
  node_pdf["PDF Edition<br/>[pdf.go]"]
end

subgraph group_web["Web Support"]
  node_pwa["PWA Support<br/>[serviceworker.js]"]
end

node_learner(("Learner"))
node_learner_online(("Online Reader"))

node_learner -->|"studies solutions"| node_search
node_learner -->|"studies solutions"| node_strings
node_learner -->|"studies solutions"| node_lists
node_learner -->|"studies solutions"| node_trees
node_learner -->|"studies solutions"| node_graphs
node_learner -->|"studies solutions"| node_dynamic
node_learner -->|"studies solutions"| node_backtracking
node_learner -->|"studies solutions"| node_math
node_learner_online -->|"reads online"| node_cookbook
node_learner -->|"downloads edition"| node_pdf
node_learner_online -->|"installs PWA"| node_pwa
node_trees -->|"uses types"| node_tree_types
node_search -->|"uses structure"| node_segment_tree

click node_search "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0704.Binary-Search/704.%20Binary%20Search.go"
click node_strings "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0005.Longest-Palindromic-Substring/5.%20Longest%20Palindromic%20Substring.go"
click node_lists "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82.%20Remove%20Duplicates%20from%20Sorted%20List%20II.go"
click node_trees "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0098.Validate-Binary-Search-Tree/98.%20Validate%20Binary%20Search%20Tree.go"
click node_graphs "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0815.Bus-Routes/815.%20Bus%20Routes.go"
click node_dynamic "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0509.Fibonacci-Number/509.%20Fibonacci%20Number.go"
click node_backtracking "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0079.Word-Search/79.%20Word%20Search.go"
click node_math "https://github.com/halfrost/leetcode-go/blob/master/leetcode/0167.Two-Sum-II-Input-array-is-sorted/167.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted.go"
click node_tree_types "https://github.com/halfrost/leetcode-go/blob/master/structures/TreeNode.go"
click node_segment_tree "https://github.com/halfrost/leetcode-go/blob/master/template/SegmentTree.go"
click node_cookbook "https://github.com/halfrost/leetcode-go/tree/master/website"
click node_pdf "https://github.com/halfrost/leetcode-go/blob/master/ctl/pdf.go"
click node_pwa "https://github.com/halfrost/leetcode-go/blob/master/website/sw-src/serviceworker.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_search,node_strings,node_lists,node_trees,node_graphs,node_dynamic,node_backtracking,node_math toneBlue
class node_tree_types,node_segment_tree toneAmber
class node_cookbook,node_pdf toneMint
class node_pwa toneRose
class node_learner,node_learner_online toneIndigo
```

## Components

### Go Solutions

- [Search and Arrays](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0704.Binary-Search/704.%20Binary%20Search.go): `leetcode/0704.Binary-Search/704. Binary Search.go`
- [Strings and Windows](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0005.Longest-Palindromic-Substring/5.%20Longest%20Palindromic%20Substring.go): `leetcode/0005.Longest-Palindromic-Substring/5. Longest Palindromic Substring.go`
- [Lists and Stacks](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82.%20Remove%20Duplicates%20from%20Sorted%20List%20II.go): `leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II.go`
- [Tree Algorithms](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0098.Validate-Binary-Search-Tree/98.%20Validate%20Binary%20Search%20Tree.go): `leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree.go`
- [Graph Search](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0815.Bus-Routes/815.%20Bus%20Routes.go): `leetcode/0815.Bus-Routes/815. Bus Routes.go`
- [Dynamic Programming](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0509.Fibonacci-Number/509.%20Fibonacci%20Number.go): `leetcode/0509.Fibonacci-Number/509. Fibonacci Number.go`
- [Backtracking](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0079.Word-Search/79.%20Word%20Search.go): `leetcode/0079.Word-Search/79. Word Search.go`
- [Math and Bits](https://github.com/halfrost/leetcode-go/blob/master/leetcode/0167.Two-Sum-II-Input-array-is-sorted/167.%20Two%20Sum%20II%20-%20Input%20array%20is%20sorted.go): `leetcode/0167.Two-Sum-II-Input-array-is-sorted/167. Two Sum II - Input array is sorted.go`

### Shared Structures

- [Tree Types](https://github.com/halfrost/leetcode-go/blob/master/structures/TreeNode.go): `structures/TreeNode.go`
- [Segment Tree](https://github.com/halfrost/leetcode-go/blob/master/template/SegmentTree.go): `template/SegmentTree.go`

### Cookbook Editions

- [Online Cookbook](https://github.com/halfrost/leetcode-go/tree/master/website): `website`
- [PDF Edition](https://github.com/halfrost/leetcode-go/blob/master/ctl/pdf.go): `ctl/pdf.go`

### Web Support

- [PWA Support](https://github.com/halfrost/leetcode-go/blob/master/website/sw-src/serviceworker.js): `website/sw-src/serviceworker.js`

### Other components

- **Learner**
- **Online Reader**

## Connections

- Learner → Search and Arrays: studies solutions (evidence: `README.md`)
- Learner → Strings and Windows: studies solutions (evidence: `README.md`)
- Learner → Lists and Stacks: studies solutions (evidence: `README.md`)
- Learner → Tree Algorithms: studies solutions (evidence: `README.md`)
- Learner → Graph Search: studies solutions (evidence: `README.md`)
- Learner → Dynamic Programming: studies solutions (evidence: `README.md`)
- Learner → Backtracking: studies solutions (evidence: `README.md`)
- Learner → Math and Bits: studies solutions (evidence: `README.md`)
- Online Reader → Online Cookbook: reads online (evidence: `README.md`)
- Learner → PDF Edition: downloads edition (evidence: `README.md`)
- Online Reader → PWA Support: installs PWA (evidence: `README.md`)
- Tree Algorithms → Tree Types: uses types (evidence: `leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree.go`)
- Search and Arrays → Segment Tree: uses structure
