# krishnasikarwar7/dsa-leetcode architecture

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

- Interactive diagram: https://gitdiagram.com/krishnasikarwar7/dsa-leetcode
- Repository: https://github.com/krishnasikarwar7/dsa-leetcode

## Overview

##### Project type and purpose
- This is neither a full-stack app nor a distributed service—it’s a monolithic repository of C++ solutions to LeetCode DSA problems.
- Purpose: serve as a personal archive and practice log. Each top-level folder is a standalone “module” containing a problem statement (README.md) and a final implementation (.cpp).

##### File structure
- Top-level directories: “1-two-sum”, “1013-fibonacci-number”, …, each named after a LeetCode problem ID and title.
- Inside each problem folder:
- README.md → problem description and metadata
- *.cpp → final C++ solution
- Root README.md describes the entire repo.
- No build scripts or CI configs are present (but can be added).

##### README for additional insights
- Languages used: C++ only.
- No reference to tests, build system, CI/CD, or deployment.

a. Main components
- Developer workstation (IDE, local compiler)
- Git repository (hosted on GitHub/GitLab)
- Build/CI pipeline (optional CI service)
- Problem modules (folders 1-two-sum, 1013-fibonacci-number, …)
- C++ compiler toolchain
- (Optional) Test harness or runner
b. Relationships & data flow
1. Developer edits .cpp and README.md locally.
2. Changes → commit → push to remote Git repo.
3. Git hook / CI triggers:
– Build step: compiler compiles each .cpp (all modules or target list).
– (Optional) Test runner validates outputs against known results.
4. CI logs/artifacts stored.
c. Architectural patterns & design principles
- Single Responsibility: each module folder encapsulates exactly one problem’s description + solution.
- Convention-over-configuration: folder naming scheme “<ID>-<title>” as automatic discovery of modules.
- Potential extension to a script-driven build system (e.g., CMake, Makefile) to auto-gather all .cpp.
d. Key technologies & libraries
- C++17 (or later) compiler (g++, clang++)
- Git (version control)
- Optional CI service (GitHub Actions, GitLab CI)
- (Optional) Test framework (Google Test, Catch2)

##### Detail
- Build discovery mechanism (wildcard .cpp detection or explicit list).
- Avoid over-splitting—each problem folder is atomic; don’t break it into smaller pieces. Instead, focus on the end-to-end flow: edit → commit → build → (optional) test.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    Developer["Developer\n(IDE & Local Compiler)"]:::external

    %% Repository
    Repo["Git Repository\nRoot"]:::static
    click Repo "https://github.com/krishnasikarwar7/dsa-leetcode/blob/main/README.md"

    subgraph "DSA Modules" 
        direction TB
        Module1["Module: 1-two-sum"]:::static
        Module1Desc["README.md"]:::static
        Module1Solution["two-sum.cpp"]:::static
        click Module1Desc "https://github.com/krishnasikarwar7/dsa-leetcode/blob/main/1-two-sum/README.md"
        click Module1Solution "https://github.com/krishnasikarwar7/dsa-leetcode/blob/main/1-two-sum/two-sum.cpp"

        Module2["Module: 1013-fibonacci-number"]:::static
        Module2Desc["README.md"]:::static
        Module2Solution["fibonacci-number.cpp"]:::static
        click Module2Desc "https://github.com/krishnasikarwar7/dsa-leetcode/blob/main/1013-fibonacci-number/README.md"
        click Module2Solution "https://github.com/krishnasikarwar7/dsa-leetcode/blob/main/1013-fibonacci-number/fibonacci-number.cpp"
    end

    CI["CI Service\n(Build & Test)"]:::external
    Compiler["C++ Compiler\n(g++, clang++)"]:::process
    TestRunner["Test Runner\n(GoogleTest/Catch2)"]:::process

    %% Flows
    Developer -->|edit & commit| Repo
    Repo -->|push triggers| CI
    CI -->|"compile all modules"| Compiler
    Compiler -->|"run tests"| TestRunner
    TestRunner -->|"report results"| CI

    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef static fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef process fill:#90EE90,stroke:#333,stroke-width:1px;
```
