# dhruvgupta-og/leetcode-solutions architecture

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

- Interactive diagram: https://gitdiagram.com/dhruvgupta-og/leetcode-solutions
- Repository: https://github.com/dhruvgupta-og/leetcode-solutions

## Overview

This repository is a collection of independent C++ solutions to LeetCode problems, not a single application or shared library. The user selects a problem, supplies its input through the platform’s expected interface, and receives that solution’s return value. The solutions cover array and search problems, string processing, linked lists, and other numeric or sequence algorithms. No shared runtime, dispatcher, or README workflow is shown; the dashed invocation links represent the implied per-solution use. Some files were not excerpted, so their internal behavior is not expanded here.

Main entry points: [`1019-squares-of-a-sorted-array/squares-of-a-sorted-array.cpp`](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/1019-squares-of-a-sorted-array/squares-of-a-sorted-array.cpp) (Sorted squares), [`11-container-with-most-water/container-with-most-water.cpp`](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/11-container-with-most-water/container-with-most-water.cpp) (Container water), [`15-3sum/3sum.cpp`](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/15-3sum/3sum.cpp) (Three sum), [`167-two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.cpp`](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/167-two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.cpp) (Sorted two sum)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arrays["Arrays and Search"]
  node_squares["Sorted squares"]
  node_water_container["Container water"]
  node_three_sum["Three sum<br/>[3sum.cpp]"]
  node_two_sum_sorted["Sorted two sum"]
  node_rotate["Rotate array<br/>[rotate-array.cpp]"]
  node_product_except["Product except self"]
  node_window_distinct["Distinct window sum"]
  node_move_zeroes["Move zeroes<br/>[move-zeroes.cpp]"]
  node_split_array["Split array"]
  node_trap_rain["Trapping rain"]
  node_max_ones["Max consecutive ones"]
  node_max_subarray["Maximum subarray"]
  node_max_circular["Circular subarray"]
  node_binary_search["Binary search<br/>[binary-search.cpp]"]
  node_matrix_search["Matrix search"]
  node_insert_position["Search insert"]
  node_rotated_min["Rotated minimum"]
  node_peak["Peak element"]
  node_pivot["Pivot index"]
  node_abs_sum["Absolute subarray sum"]
  node_continuous_sum["Continuous subarray sum"]
end

subgraph group_strings["Strings"]
  node_valid_palindrome["Valid palindrome"]
  node_valid_palindrome_two["Palindrome with deletion"]
  node_reverse_string["Reverse string<br/>[reverse-string.cpp]"]
  node_isomorphic["Isomorphic strings"]
  node_parentheses["Valid parentheses"]
end

subgraph group_lists["Linked Lists"]
  node_cycle["Detect list cycle"]
  node_cycle_start["Find cycle start"]
  node_remove_nth["Remove nth node"]
  node_reverse_list["Reverse list"]
  node_palindrome_list["Palindrome list"]
  node_middle_list["Middle list node"]
end

subgraph group_other["Other Algorithms"]
  node_single_number["Single number<br/>[single-number.cpp]"]
end

node_user(("Problem user"))

node_user -.->|"invokes"| node_squares
node_user -.->|"invokes"| node_water_container
node_user -.->|"invokes"| node_three_sum
node_user -.->|"invokes"| node_two_sum_sorted
node_user -.->|"invokes"| node_rotate
node_user -.->|"invokes"| node_product_except
node_user -.->|"invokes"| node_window_distinct
node_user -.->|"invokes"| node_move_zeroes
node_user -.->|"invokes"| node_split_array
node_user -.->|"invokes"| node_trap_rain
node_user -.->|"invokes"| node_max_ones
node_user -.->|"invokes"| node_max_subarray
node_user -.->|"invokes"| node_max_circular
node_user -.->|"invokes"| node_binary_search
node_user -.->|"invokes"| node_matrix_search
node_user -.->|"invokes"| node_insert_position
node_user -.->|"invokes"| node_rotated_min
node_user -.->|"invokes"| node_peak
node_user -.->|"invokes"| node_pivot
node_user -.->|"invokes"| node_abs_sum
node_user -.->|"invokes"| node_continuous_sum
node_user -.->|"invokes"| node_valid_palindrome
node_user -.->|"invokes"| node_valid_palindrome_two
node_user -.->|"invokes"| node_reverse_string
node_user -.->|"invokes"| node_isomorphic
node_user -.->|"invokes"| node_parentheses
node_user -.->|"invokes"| node_cycle
node_user -.->|"invokes"| node_cycle_start
node_user -.->|"invokes"| node_remove_nth
node_user -.->|"invokes"| node_reverse_list
node_user -.->|"invokes"| node_palindrome_list
node_user -.->|"invokes"| node_middle_list
node_user -.->|"invokes"| node_single_number

click node_squares "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/1019-squares-of-a-sorted-array/squares-of-a-sorted-array.cpp"
click node_water_container "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/11-container-with-most-water/container-with-most-water.cpp"
click node_three_sum "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/15-3sum/3sum.cpp"
click node_two_sum_sorted "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/167-two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.cpp"
click node_rotate "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/189-rotate-array/rotate-array.cpp"
click node_product_except "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/238-product-of-array-except-self/product-of-array-except-self.cpp"
click node_window_distinct "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/2552-maximum-sum-of-distinct-subarrays-with-length-k/maximum-sum-of-distinct-subarrays-with-length-k.cpp"
click node_move_zeroes "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/283-move-zeroes/move-zeroes.cpp"
click node_split_array "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/410-split-array-largest-sum/split-array-largest-sum.cpp"
click node_trap_rain "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/42-trapping-rain-water/trapping-rain-water.cpp"
click node_max_ones "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/485-max-consecutive-ones/max-consecutive-ones.cpp"
click node_max_subarray "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/53-maximum-subarray/maximum-subarray.cpp"
click node_max_circular "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/954-maximum-sum-circular-subarray/maximum-sum-circular-subarray.cpp"
click node_binary_search "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/792-binary-search/binary-search.cpp"
click node_matrix_search "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/74-search-a-2d-matrix/search-a-2d-matrix.cpp"
click node_insert_position "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/35-search-insert-position/search-insert-position.cpp"
click node_rotated_min "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/153-find-minimum-in-rotated-sorted-array/find-minimum-in-rotated-sorted-array.cpp"
click node_peak "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/162-find-peak-element/find-peak-element.cpp"
click node_pivot "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/724-find-pivot-index/find-pivot-index.cpp"
click node_abs_sum "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/1849-maximum-absolute-sum-of-any-subarray/maximum-absolute-sum-of-any-subarray.cpp"
click node_continuous_sum "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/523-continuous-subarray-sum/continuous-subarray-sum.cpp"
click node_valid_palindrome "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/125-valid-palindrome/valid-palindrome.cpp"
click node_valid_palindrome_two "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/680-valid-palindrome-ii/valid-palindrome-ii.cpp"
click node_reverse_string "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/344-reverse-string/reverse-string.cpp"
click node_isomorphic "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/205-isomorphic-strings/isomorphic-strings.cpp"
click node_parentheses "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/20-valid-parentheses/valid-parentheses.cpp"
click node_cycle "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/141-linked-list-cycle/linked-list-cycle.cpp"
click node_cycle_start "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/142-linked-list-cycle-ii/linked-list-cycle-ii.cpp"
click node_remove_nth "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/19-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.cpp"
click node_reverse_list "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/206-reverse-linked-list/reverse-linked-list.cpp"
click node_palindrome_list "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/234-palindrome-linked-list/palindrome-linked-list.cpp"
click node_middle_list "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/908-middle-of-the-linked-list/middle-of-the-linked-list.cpp"
click node_single_number "https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/136-single-number/single-number.cpp"

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_squares,node_water_container,node_three_sum,node_two_sum_sorted,node_rotate,node_product_except,node_window_distinct,node_move_zeroes,node_split_array,node_trap_rain,node_max_ones,node_max_subarray,node_max_circular,node_binary_search,node_matrix_search,node_insert_position,node_rotated_min,node_peak,node_pivot,node_abs_sum,node_continuous_sum,node_user toneBlue
class node_valid_palindrome,node_valid_palindrome_two,node_reverse_string,node_isomorphic,node_parentheses toneAmber
class node_cycle,node_cycle_start,node_remove_nth,node_reverse_list,node_palindrome_list,node_middle_list toneMint
class node_single_number toneRose
```

## Components

### Arrays and Search

- [Sorted squares](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/1019-squares-of-a-sorted-array/squares-of-a-sorted-array.cpp): `1019-squares-of-a-sorted-array/squares-of-a-sorted-array.cpp`
- [Container water](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/11-container-with-most-water/container-with-most-water.cpp): `11-container-with-most-water/container-with-most-water.cpp`
- [Three sum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/15-3sum/3sum.cpp): `15-3sum/3sum.cpp`
- [Sorted two sum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/167-two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.cpp): `167-two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.cpp`
- [Rotate array](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/189-rotate-array/rotate-array.cpp): `189-rotate-array/rotate-array.cpp`
- [Product except self](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/238-product-of-array-except-self/product-of-array-except-self.cpp): `238-product-of-array-except-self/product-of-array-except-self.cpp`
- [Distinct window sum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/2552-maximum-sum-of-distinct-subarrays-with-length-k/maximum-sum-of-distinct-subarrays-with-length-k.cpp): `2552-maximum-sum-of-distinct-subarrays-with-length-k/maximum-sum-of-distinct-subarrays-with-length-k.cpp`
- [Move zeroes](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/283-move-zeroes/move-zeroes.cpp): `283-move-zeroes/move-zeroes.cpp`
- [Split array](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/410-split-array-largest-sum/split-array-largest-sum.cpp): `410-split-array-largest-sum/split-array-largest-sum.cpp`
- [Trapping rain](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/42-trapping-rain-water/trapping-rain-water.cpp): `42-trapping-rain-water/trapping-rain-water.cpp`
- [Max consecutive ones](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/485-max-consecutive-ones/max-consecutive-ones.cpp): `485-max-consecutive-ones/max-consecutive-ones.cpp`
- [Maximum subarray](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/53-maximum-subarray/maximum-subarray.cpp): `53-maximum-subarray/maximum-subarray.cpp`
- [Circular subarray](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/954-maximum-sum-circular-subarray/maximum-sum-circular-subarray.cpp): `954-maximum-sum-circular-subarray/maximum-sum-circular-subarray.cpp`
- [Binary search](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/792-binary-search/binary-search.cpp): `792-binary-search/binary-search.cpp`
- [Matrix search](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/74-search-a-2d-matrix/search-a-2d-matrix.cpp): `74-search-a-2d-matrix/search-a-2d-matrix.cpp`
- [Search insert](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/35-search-insert-position/search-insert-position.cpp): `35-search-insert-position/search-insert-position.cpp`
- [Rotated minimum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/153-find-minimum-in-rotated-sorted-array/find-minimum-in-rotated-sorted-array.cpp): `153-find-minimum-in-rotated-sorted-array/find-minimum-in-rotated-sorted-array.cpp`
- [Peak element](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/162-find-peak-element/find-peak-element.cpp): `162-find-peak-element/find-peak-element.cpp`
- [Pivot index](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/724-find-pivot-index/find-pivot-index.cpp): `724-find-pivot-index/find-pivot-index.cpp`
- [Absolute subarray sum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/1849-maximum-absolute-sum-of-any-subarray/maximum-absolute-sum-of-any-subarray.cpp): `1849-maximum-absolute-sum-of-any-subarray/maximum-absolute-sum-of-any-subarray.cpp`
- [Continuous subarray sum](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/523-continuous-subarray-sum/continuous-subarray-sum.cpp): `523-continuous-subarray-sum/continuous-subarray-sum.cpp`

### Strings

- [Valid palindrome](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/125-valid-palindrome/valid-palindrome.cpp): `125-valid-palindrome/valid-palindrome.cpp`
- [Palindrome with deletion](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/680-valid-palindrome-ii/valid-palindrome-ii.cpp): `680-valid-palindrome-ii/valid-palindrome-ii.cpp`
- [Reverse string](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/344-reverse-string/reverse-string.cpp): `344-reverse-string/reverse-string.cpp`
- [Isomorphic strings](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/205-isomorphic-strings/isomorphic-strings.cpp): `205-isomorphic-strings/isomorphic-strings.cpp`
- [Valid parentheses](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/20-valid-parentheses/valid-parentheses.cpp): `20-valid-parentheses/valid-parentheses.cpp`

### Linked Lists

- [Detect list cycle](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/141-linked-list-cycle/linked-list-cycle.cpp): `141-linked-list-cycle/linked-list-cycle.cpp`
- [Find cycle start](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/142-linked-list-cycle-ii/linked-list-cycle-ii.cpp): `142-linked-list-cycle-ii/linked-list-cycle-ii.cpp`
- [Remove nth node](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/19-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.cpp): `19-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.cpp`
- [Reverse list](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/206-reverse-linked-list/reverse-linked-list.cpp): `206-reverse-linked-list/reverse-linked-list.cpp`
- [Palindrome list](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/234-palindrome-linked-list/palindrome-linked-list.cpp): `234-palindrome-linked-list/palindrome-linked-list.cpp`
- [Middle list node](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/908-middle-of-the-linked-list/middle-of-the-linked-list.cpp): `908-middle-of-the-linked-list/middle-of-the-linked-list.cpp`

### Other Algorithms

- [Single number](https://github.com/dhruvgupta-og/leetcode-solutions/blob/main/136-single-number/single-number.cpp): `136-single-number/single-number.cpp`

### Other components

- **Problem user**

## Connections

- Problem user → Sorted squares: invokes
- Problem user → Container water: invokes
- Problem user → Three sum: invokes
- Problem user → Sorted two sum: invokes
- Problem user → Rotate array: invokes
- Problem user → Product except self: invokes
- Problem user → Distinct window sum: invokes
- Problem user → Move zeroes: invokes
- Problem user → Split array: invokes
- Problem user → Trapping rain: invokes
- Problem user → Max consecutive ones: invokes
- Problem user → Maximum subarray: invokes
- Problem user → Circular subarray: invokes
- Problem user → Binary search: invokes
- Problem user → Matrix search: invokes
- Problem user → Search insert: invokes
- Problem user → Rotated minimum: invokes
- Problem user → Peak element: invokes
- Problem user → Pivot index: invokes
- Problem user → Absolute subarray sum: invokes
- Problem user → Continuous subarray sum: invokes
- Problem user → Valid palindrome: invokes
- Problem user → Palindrome with deletion: invokes
- Problem user → Reverse string: invokes
- Problem user → Isomorphic strings: invokes
- Problem user → Valid parentheses: invokes
- Problem user → Detect list cycle: invokes
- Problem user → Find cycle start: invokes
- Problem user → Remove nth node: invokes
- Problem user → Reverse list: invokes
- Problem user → Palindrome list: invokes
- Problem user → Middle list node: invokes
- Problem user → Single number: invokes
