# techwhiz42/leetcode-submissions architecture

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

- Interactive diagram: https://gitdiagram.com/techwhiz42/leetcode-submissions
- Repository: https://github.com/techwhiz42/leetcode-submissions

## Overview

1. **Repository purpose**
   - This is not a single application; it is a **catalog of independent LeetCode submissions**.
   - Each numbered folder is a self-contained solution package for one problem, usually with one C++ source file and one problem-specific README.

2. **Top-level structure**
   - The repo root contains:
     - many problem directories such as `0001-two-sum`, `0208-implement-trie-prefix-tree`, `2685-count-the-number-of-complete-components`
     - a root `README.md` that acts as an index and topic catalog
     - `stats.json`, likely generated metadata about submission counts / progress
     - `.github/workflows/sync_leetcode.yml`, which automates syncing content from LeetCode

3. **Per-problem module boundary**
   - Each problem directory is an **isolated module** with no cross-directory imports or shared library code.
   - Typical contents:
     - `solution.cpp` as the canonical submission source
     - `README.md` copied or generated for that problem
     - in some folders, a duplicate `.cpp` file named after the problem ID, suggesting an alternate export artifact from LeetHub or a retained backup copy

4. **Execution model**
   - There is no long-running service, API server, or runtime orchestration.
   - The effective “execution unit” is a **single algorithm function/class** in C++ that LeetCode compiles and runs against hidden tests.
   - Architecturally, each folder maps to a problem-specific compile-and-test boundary.

5. **Language and solution style**
   - The repo is overwhelmingly **C++-based**, with each solution written as a standalone submission file.
   - Solutions are algorithmic and data-structure oriented rather than application-oriented, covering arrays, strings, linked lists, trees, graphs, dynamic programming, and design problems.

6. **Documentation flow**
   - Problem READMEs appear to preserve the original LeetCode prompt, notes, or solution metadata.
   - The root README aggregates topic tags and links to the corresponding problem folders, serving as a navigational index across the solution set.

7. **Automation / synchronization**
   - `.github/workflows/sync_leetcode.yml` indicates the repo is automatically synchronized, likely pulling accepted submissions and README content from LeetCode via LeetHub.
   - This workflow is the main infrastructure boundary in the repository: it updates source files and metadata, but does not affect algorithm runtime behavior.

8. **Data flow**
   - The main flow is:
     - problem solved on LeetCode
     - solution and metadata synced into a problem folder
     - root README and stats/index data updated for browsing
   - There is no data flow between problems; all shared structure is editorial, not computational.

9. **Subsystem grouping by topic**
   - The root README groups problems by technique, which reflects the codebase’s conceptual structure:
     - arrays / hashing / sorting
     - linked lists / two pointers / stack
     - trees / DFS / BFS / binary tree
     - graphs / union-find
     - trie / design
   - This grouping is for discovery, not runtime dependency.

10. **Important architectural takeaway**
   - When drawing a diagram, model this repo as:
     - a **central index/documentation layer** at the root
     - a **set of independent problem solution packages**
     - a **sync automation layer** feeding the packages from LeetCode
   - There is no shared backend, no shared service graph, and no inter-module coupling beyond documentation and generated metadata.

Main entry points: [`README.md`](https://github.com/techwhiz42/leetcode-submissions/blob/main/README.md) (README), [`.github/workflows/sync_leetcode.yml`](https://github.com/techwhiz42/leetcode-submissions/blob/main/.github/workflows/sync_leetcode.yml) (Sync LeetCode), [`0208-implement-trie-prefix-tree`](https://github.com/techwhiz42/leetcode-submissions/tree/main/0208-implement-trie-prefix-tree) (Trie), [`stats.json`](https://github.com/techwhiz42/leetcode-submissions/blob/main/stats.json) (Stats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Documentation"]
  node_root_readme["README<br/>catalog index<br/>[README.md]"]
  node_stats_json["Stats<br/>progress metadata<br/>[stats.json]"]
end

subgraph group_automation["Automation"]
  node_sync_workflow["Sync LeetCode<br/>github workflow<br/>[sync_leetcode.yml]"]
end

subgraph group_arrays["Array / Math"]
  node_p0001["Two Sum<br/>problem module"]
  node_p0015["3Sum<br/>problem module"]
  node_p0238["Product Except<br/>problem module"]
  node_p0347["Top K<br/>problem module"]
end

subgraph group_lists["Linked Structures"]
  node_p0019["Remove Nth<br/>problem module"]
  node_p0023["Merge K Lists<br/>problem module"]
  node_p0143["Reorder List<br/>problem module"]
end

subgraph group_trees["Trees"]
  node_p0094["Inorder<br/>problem module"]
  node_p0105["Build Tree<br/>problem module"]
  node_p0236["LCA Tree<br/>problem module"]
end

subgraph group_graphs["Graphs"]
  node_p0200["Islands<br/>problem module"]
  node_p2582["Min Score Path<br/>problem module"]
  node_p2914["Safest Path<br/>problem module"]
end

subgraph group_strings["Strings / Design"]
  node_p0208["Trie<br/>problem module"]
  node_p0211["Word Search<br/>problem module"]
  node_p1122["Dup Substring<br/>problem module"]
end

node_sync_workflow -->|"syncs"| node_p0001
node_sync_workflow -->|"syncs"| node_p0023
node_sync_workflow -->|"syncs"| node_p0208
node_sync_workflow -->|"updates"| node_stats_json
node_sync_workflow -->|"refreshes"| node_root_readme
node_root_readme -->|"indexes"| node_p0001
node_root_readme -->|"indexes"| node_p0015
node_root_readme -->|"indexes"| node_p0238
node_root_readme -->|"indexes"| node_p0094
node_root_readme -->|"indexes"| node_p0200
node_root_readme -->|"indexes"| node_p0208
node_root_readme -->|"indexes"| node_p2582
node_root_readme -->|"indexes"| node_p2914
node_stats_json -->|"summarizes"| node_root_readme
node_p0208 -->|"same pattern"| node_p0211
node_p0094 -->|"same pattern"| node_p0105
node_p0200 -->|"same pattern"| node_p2914

click node_root_readme "https://github.com/techwhiz42/leetcode-submissions/blob/main/README.md"
click node_stats_json "https://github.com/techwhiz42/leetcode-submissions/blob/main/stats.json"
click node_sync_workflow "https://github.com/techwhiz42/leetcode-submissions/blob/main/.github/workflows/sync_leetcode.yml"
click node_p0001 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0001-two-sum"
click node_p0015 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0015-3sum"
click node_p0238 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0238-product-of-array-except-self"
click node_p0347 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0347-top-k-frequent-elements"
click node_p0019 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0019-remove-nth-node-from-end-of-list"
click node_p0023 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0023-merge-k-sorted-lists"
click node_p0143 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0143-reorder-list"
click node_p0094 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0094-binary-tree-inorder-traversal"
click node_p0105 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0105-construct-binary-tree-from-preorder-and-inorder-traversal"
click node_p0236 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0236-lowest-common-ancestor-of-a-binary-tree"
click node_p0200 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0200-number-of-islands"
click node_p0208 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0208-implement-trie-prefix-tree"
click node_p0211 "https://github.com/techwhiz42/leetcode-submissions/tree/main/0211-design-add-and-search-words-data-structure"
click node_p1122 "https://github.com/techwhiz42/leetcode-submissions/tree/main/1122-longest-duplicate-substring"
click node_p2582 "https://github.com/techwhiz42/leetcode-submissions/tree/main/2582-minimum-score-of-a-path-between-two-cities"
click node_p2914 "https://github.com/techwhiz42/leetcode-submissions/tree/main/2914-find-the-safest-path-in-a-grid"

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_root_readme,node_stats_json,node_p0208,node_p0211,node_p1122 toneBlue
class node_sync_workflow toneAmber
class node_p0001,node_p0015,node_p0238,node_p0347 toneMint
class node_p0019,node_p0023,node_p0143 toneRose
class node_p0094,node_p0105,node_p0236 toneIndigo
class node_p0200,node_p2582,node_p2914 toneTeal
```

## Components

### Documentation

Root-level browsing and progress index for the submission catalog.

- [README](https://github.com/techwhiz42/leetcode-submissions/blob/main/README.md): catalog index · Root index and topic catalog for the submission repository. · `README.md`
- [Stats](https://github.com/techwhiz42/leetcode-submissions/blob/main/stats.json): progress metadata · Generated repository-wide metadata about submissions and progress. · `stats.json`

### Automation

Sync workflow that updates submissions and metadata from LeetCode.

- [Sync LeetCode](https://github.com/techwhiz42/leetcode-submissions/blob/main/.github/workflows/sync_leetcode.yml): github workflow · Automation that syncs accepted submissions and README content. · `.github/workflows/sync_leetcode.yml`

### Array / Math

Representative problem modules centered on array, numeric, and greedy techniques.

- [Two Sum](https://github.com/techwhiz42/leetcode-submissions/tree/main/0001-two-sum): problem module · Standalone C++ solution package for a single LeetCode problem. · `0001-two-sum`
- [3Sum](https://github.com/techwhiz42/leetcode-submissions/tree/main/0015-3sum): problem module · Standalone C++ solution package for a single LeetCode problem. · `0015-3sum`
- [Product Except](https://github.com/techwhiz42/leetcode-submissions/tree/main/0238-product-of-array-except-self): problem module · Standalone C++ solution package for a single LeetCode problem. · `0238-product-of-array-except-self`
- [Top K](https://github.com/techwhiz42/leetcode-submissions/tree/main/0347-top-k-frequent-elements): problem module · Standalone C++ solution package for a single LeetCode problem. · `0347-top-k-frequent-elements`

### Linked Structures

Representative modules for linked lists and stack-style manipulation.

- [Remove Nth](https://github.com/techwhiz42/leetcode-submissions/tree/main/0019-remove-nth-node-from-end-of-list): problem module · Standalone C++ solution package for a single LeetCode problem. · `0019-remove-nth-node-from-end-of-list`
- [Merge K Lists](https://github.com/techwhiz42/leetcode-submissions/tree/main/0023-merge-k-sorted-lists): problem module · Standalone C++ solution package for a single LeetCode problem. · `0023-merge-k-sorted-lists`
- [Reorder List](https://github.com/techwhiz42/leetcode-submissions/tree/main/0143-reorder-list): problem module · Standalone C++ solution package for a single LeetCode problem. · `0143-reorder-list`

### Trees

Representative binary-tree and BST solution modules.

- [Inorder](https://github.com/techwhiz42/leetcode-submissions/tree/main/0094-binary-tree-inorder-traversal): problem module · Standalone C++ solution package for a single LeetCode problem. · `0094-binary-tree-inorder-traversal`
- [Build Tree](https://github.com/techwhiz42/leetcode-submissions/tree/main/0105-construct-binary-tree-from-preorder-and-inorder-traversal): problem module · Standalone C++ solution package for a single LeetCode problem. · `0105-construct-binary-tree-from-preorder-and-inorder-traversal`
- [LCA Tree](https://github.com/techwhiz42/leetcode-submissions/tree/main/0236-lowest-common-ancestor-of-a-binary-tree): problem module · Standalone C++ solution package for a single LeetCode problem. · `0236-lowest-common-ancestor-of-a-binary-tree`

### Graphs

Representative graph and grid traversal modules.

- [Islands](https://github.com/techwhiz42/leetcode-submissions/tree/main/0200-number-of-islands): problem module · Standalone C++ solution package for a single LeetCode problem. · `0200-number-of-islands`
- [Min Score Path](https://github.com/techwhiz42/leetcode-submissions/tree/main/2582-minimum-score-of-a-path-between-two-cities): problem module · Standalone C++ solution package for a single LeetCode problem. · `2582-minimum-score-of-a-path-between-two-cities`
- [Safest Path](https://github.com/techwhiz42/leetcode-submissions/tree/main/2914-find-the-safest-path-in-a-grid): problem module · Standalone C++ solution package for a single LeetCode problem. · `2914-find-the-safest-path-in-a-grid`

### Strings / Design

Representative string, trie, and design-oriented modules.

- [Trie](https://github.com/techwhiz42/leetcode-submissions/tree/main/0208-implement-trie-prefix-tree): problem module · Standalone C++ solution package for a single LeetCode problem. · `0208-implement-trie-prefix-tree`
- [Word Search](https://github.com/techwhiz42/leetcode-submissions/tree/main/0211-design-add-and-search-words-data-structure): problem module · Standalone C++ solution package for a single LeetCode problem. · `0211-design-add-and-search-words-data-structure`
- [Dup Substring](https://github.com/techwhiz42/leetcode-submissions/tree/main/1122-longest-duplicate-substring): problem module · Standalone C++ solution package for a single LeetCode problem. · `1122-longest-duplicate-substring`

## Connections

- Sync LeetCode → Two Sum: syncs · Updates standalone submission folders from LeetCode.
- Sync LeetCode → Merge K Lists: syncs · Updates standalone submission folders from LeetCode.
- Sync LeetCode → Trie: syncs · Updates standalone submission folders from LeetCode.
- Sync LeetCode → Stats: updates · Refreshes repository progress metadata.
- Sync LeetCode → README: refreshes · Keeps the catalog index aligned with synced submissions.
- README → Two Sum: indexes · Points to problem modules in the catalog.
- README → 3Sum: indexes · Points to problem modules in the catalog.
- README → Product Except: indexes · Points to problem modules in the catalog.
- README → Inorder: indexes · Points to problem modules in the catalog.
- README → Islands: indexes · Points to problem modules in the catalog.
- README → Trie: indexes · Points to problem modules in the catalog.
- README → Min Score Path: indexes · Points to problem modules in the catalog.
- README → Safest Path: indexes · Points to problem modules in the catalog.
- Stats → README: summarizes · Provides repository-wide progress context for the index.
- Trie → Word Search: same pattern · Both are independent trie/design-style submission modules.
- Inorder → Build Tree: same pattern · Both are independent tree-algorithm submission modules.
- Islands → Safest Path: same pattern · Both are grid/graph traversal style problems.
