# yash12-cloud/leetcode-sol architecture

> Architecture diagram of the GitHub repository yash12-cloud/leetcode-sol, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash12-cloud/leetcode-sol
- Repository: https://github.com/yash12-cloud/leetcode-sol

## Overview

##### Project type and purpose
- This is a monolithic “practice‐solutions” repository (LeetCode solutions) rather than a web service or library.
- Each top-level folder (e.g. “0001-two-sum”) contains an independent C++ (or Java, once) implementation plus its own README. There’s no shared runtime service or microservice communication.

##### File structure
- Top level:
- A root README.md with the project title (“Leetcode-sol”)
- Individual problem folders named “<problem-number>-<problem-name>”
- A few stray .cpp files at the root, likely ad-hoc or legacy
- Inside each problem folder:
- A single .cpp (or .java in one case) solution file
- A per‐problem README explaining the approach
- No build scripts, CI configs, databases, or external dependencies are present.

##### README for additional insights
- Only the project name is provided; no architectural details or tech-stack sections.
- Implicit stack: C++11/14 (g++) and one Java solution.

a. Main components
- Developer Workstation (IDE/editor)
- Git Repository (“Leetcode-sol”)
- Solution Modules (one per problem folder)
- Compiler Toolchain (g++, javac)
- Execution/Test Harness (could be runner script or manual CLI)

b. Relationships and interactions
1. Developer checks out the Git repo →
2. Opens one solution module in IDE →
3. Invokes compiler (g++ or javac) →
4. Runs the binary or JVM class to verify output →
5. Commits changes back to Git.
- Each module is independent – no intermodule calls or shared libraries.

c. Architectural patterns/design principles
- Monorepo pattern: all solutions under one versioned repository
- Module per problem: maximum separation of concerns
- Language grouping: predominantly C++; one stray Java example

d. Key technologies
- Git (version control)
- C++ compiler (g++/clang++)
- Java compiler (javac)
- Local filesystem to organize modules

##### Elements
- Clear labels: “Developer,” “Git Repo,” “Problem Module: 0001-two-sum,” “g++,” “Run/Verify.”
- From Developer → Git Repo (pull/push)
- From Git Repo → IDE/Editor (checkout)
- From IDE → Compiler (build)
- From Compiler → Executable (artifact)
- From Executable → Runtime/Test (execution)
- Repositories/folders as rounded rectangles
- Execution step as a hexagon or diamond

## Diagram (Mermaid)

```mermaid
flowchart TB
    Developer["Developer"]:::actor
    GitRepo(("Leetcode-sol")):::repo
    Developer -->|"clone/pull/push"| GitRepo
    GitRepo -->|"checkout"| IDE["IDE/Editor"]:::tool
    IDE -->|"open module"| CppModules

    subgraph "C++ Modules"
        direction TB
        M_0001["0001-two-sum"]:::module
        M_0014["0014-longest-common-prefix"]:::module
        M_0026["0026-remove-duplicates-from-sorted-array"]:::module
        M_0048["0048-rotate-image"]:::module
        M_0053["0053-maximum-subarray"]:::module
        M_0054["0054-spiral-matrix"]:::module
        M_0075["0075-sort-colors"]:::module
        M_0121["0121-best-time-to-buy-and-sell-stock"]:::module
        M_0136["0136-single-number"]:::module
        M_0189["0189-rotate-array"]:::module
        M_0209["0209-minimum-size-subarray-sum"]:::module
        M_0238["0238-product-of-array-except-self"]:::module
        M_0268["0268-missing-number"]:::module
        M_0448["0448-find-all-numbers-disappeared-in-an-array"]:::module
        M_0485["0485-max-consecutive-ones"]:::module
        M_0704["0704-binary-search"]:::module
        M_0747["0747-largest-number-at-least-twice-of-others"]:::module
        M_0977["0977-squares-of-a-sorted-array"]:::module
        M_1052["1052-grumpy-bookstore-owner"]:::module
        M_1295["1295-find-numbers-with-even-number-of-digits"]:::module
        M_1394["1394-find-lucky-integer-in-an-array"]:::module
        M_1480["1480-running-sum-of-1d-array"]:::module
        M_1752["1752-check-if-array-is-sorted-and-rotated"]:::module
        M_1800["1800-maximum-ascending-subarray-sum"]:::module
        M_1903["1903-largest-odd-number-in-string"]:::module
    end

    CppModules --> M_0001
    CppModules --> M_0014
    CppModules --> M_0026
    CppModules --> M_0048
    CppModules --> M_0053
    CppModules --> M_0054
    CppModules --> M_0075
    CppModules --> M_0121
    CppModules --> M_0136
    CppModules --> M_0189
    CppModules --> M_0209
    CppModules --> M_0238
    CppModules --> M_0268
    CppModules --> M_0448
    CppModules --> M_0485
    CppModules --> M_0704
    CppModules --> M_0747
    CppModules --> M_0977
    CppModules --> M_1052
    CppModules --> M_1295
    CppModules --> M_1394
    CppModules --> M_1480
    CppModules --> M_1752
    CppModules --> M_1800
    CppModules --> M_1903

    subgraph "Java Module"
        direction TB
        M_3392["3392-count-subarrays-of-length-three-with-a-condition"]:::module
    end
    IDE -->|"open module"| M_3392

    subgraph "Legacy / Ad-hoc C++ Files"
        direction TB
        L_26["26.cpp"]:::legacy
        L_2843["2843.cpp"]:::legacy
        L_344["344.cpp"]:::legacy
    end
    IDE -->|"open file"| L_26
    IDE -->|"open file"| L_2843
    IDE -->|"open file"| L_344

    M_0001 -->|"compile via g++"| Gpp["g++ Compiler"]:::compiler
    M_3392 -->|"compile via javac"| Javac["javac Compiler"]:::compiler
    Gpp --> Executable["Executable"]:::artifact
    Javac --> ClassFile[".class File"]:::artifact
    Executable --> Run["Run/Verify"]:::runtime
    ClassFile --> Run

    Run -->|"verify output"| IDE
    IDE -->|"commit"| GitRepo

    click GitRepo "https://github.com/yash12-cloud/leetcode-sol/blob/main/README.md"
    click M_0001 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0001-two-sum/0001-two-sum.cpp"
    click M_0014 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0014-longest-common-prefix/0014-longest-common-prefix.cpp"
    click M_0026 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp"
    click M_0048 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0048-rotate-image/0048-rotate-image.cpp"
    click M_0053 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0053-maximum-subarray/0053-maximum-subarray.cpp"
    click M_0054 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0054-spiral-matrix/0054-spiral-matrix.cpp"
    click M_0075 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0075-sort-colors/0075-sort-colors.cpp"
    click M_0121 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp"
    click M_0136 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0136-single-number/0136-single-number.cpp"
    click M_0189 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0189-rotate-array/0189-rotate-array.cpp"
    click M_0209 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0209-minimum-size-subarray-sum/0209-minimum-size-subarray-sum.cpp"
    click M_0238 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0238-product-of-array-except-self/0238-product-of-array-except-self.cpp"
    click M_0268 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0268-missing-number/0268-missing-number.cpp"
    click M_0448 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0448-find-all-numbers-disappeared-in-an-array/0448-find-all-numbers-disappeared-in-an-array.cpp"
    click M_0485 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0485-max-consecutive-ones/0485-max-consecutive-ones.cpp"
    click M_0704 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0704-binary-search/0704-binary-search.cpp"
    click M_0747 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0747-largest-number-at-least-twice-of-others/0747-largest-number-at-least-twice-of-others.cpp"
    click M_0977 "https://github.com/yash12-cloud/leetcode-sol/blob/main/0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp"
    click M_1052 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1052-grumpy-bookstore-owner/1052-grumpy-bookstore-owner.cpp"
    click M_1295 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1295-find-numbers-with-even-number-of-digits/1295-find-numbers-with-even-number-of-digits.cpp"
    click M_1394 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1394-find-lucky-integer-in-an-array/1394-find-lucky-integer-in-an-array.cpp"
    click M_1480 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1480-running-sum-of-1d-array/1480-running-sum-of-1d-array.cpp"
    click M_1752 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1752-check-if-array-is-sorted-and-rotated/1752-check-if-array-is-sorted-and-rotated.cpp"
    click M_1800 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1800-maximum-ascending-subarray-sum/1800-maximum-ascending-subarray-sum.cpp"
    click M_1903 "https://github.com/yash12-cloud/leetcode-sol/blob/main/1903-largest-odd-number-in-string/1903-largest-odd-number-in-string.cpp"
    click M_3392 "https://github.com/yash12-cloud/leetcode-sol/blob/main/3392-count-subarrays-of-length-three-with-a-condition/3392-count-subarrays-of-length-three-with-a-condition.java"
    click L_26 "https://github.com/yash12-cloud/leetcode-sol/blob/main/26.cpp"
    click L_2843 "https://github.com/yash12-cloud/leetcode-sol/blob/main/2843.cpp"
    click L_344 "https://github.com/yash12-cloud/leetcode-sol/blob/main/344.cpp"

    classDef actor fill:#f9f,stroke:#333,stroke-width:2px;
    classDef repo fill:#bbf,stroke:#333,stroke-width:2px;
    classDef tool fill:#bfb,stroke:#333,stroke-width:2px;
    classDef module fill:#ffe4b5,stroke:#333,stroke-width:2px;
    classDef compiler fill:#fcc,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef artifact fill:#cfc,stroke:#333,stroke-width:2px;
    classDef runtime fill:#fcf,stroke:#333,stroke-width:2px;
    classDef legacy fill:#ddd,stroke:#333,stroke-width:2px,stroke-dasharray: 2 2;
```
