# saiprasadpadhy/leetcode architecture

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

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

## Overview

This repository is a collection of independent LeetCode interview-problem solutions, not a single application. A user selects a problem and submits its solution to the LeetCode judge, which supplies inputs and evaluates the returned result. The README documents broad topic coverage; sampled source confirms standalone algorithm implementations, including binary search and merge-sort-based reverse-pair counting. The graph groups representative solutions by problem domain; links indicate independent judge invocations, not calls between solutions.

Main entry points: [`0001-two-sum/0001-two-sum.java`](https://github.com/saiprasadpadhy/leetcode/blob/main/0001-two-sum/0001-two-sum.java) (Two Sum), [`0073-set-matrix-zeroes/0073-set-matrix-zeroes.java`](https://github.com/saiprasadpadhy/leetcode/blob/main/0073-set-matrix-zeroes/0073-set-matrix-zeroes.java) (Matrix Zeroes), [`0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.java`](https://github.com/saiprasadpadhy/leetcode/blob/main/0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.java) (Stock Profit), [`0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.java`](https://github.com/saiprasadpadhy/leetcode/blob/main/0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.java) (Consecutive Sequence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arrays["Array algorithms"]
  node_two_sum["Two Sum<br/>[0001-two-sum.java]"]
  node_matrix_zeroes["Matrix Zeroes"]
  node_stock["Stock Profit"]
  node_consecutive["Consecutive Sequence"]
  node_majority["Majority Elements"]
  node_reverse_pairs["Reverse Pairs"]
  node_window["Sliding Window"]
end

subgraph group_search["Search algorithms"]
  node_binary_search["Binary Search"]
  node_rotated_search["Rotated Search"]
  node_duplicate_search["Duplicate Search"]
  node_search_range["Search Range"]
  node_search_insert["Search Insert"]
  node_single_element["Single Element"]
end

subgraph group_strings["String algorithms"]
  node_prefix["Common Prefix"]
  node_palindrome["Valid Palindrome"]
  node_reverse_words["Reverse Words"]
end

subgraph group_math["Math and games"]
  node_reverse_integer["Reverse Integer"]
  node_perfect_number["Perfect Number"]
  node_divisor_game["Divisor Game"]
  node_add_integers["Add Integers"]
end

node_judge(("LeetCode judge"))

node_judge -->|"supplies input"| node_two_sum
node_two_sum -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_matrix_zeroes
node_matrix_zeroes -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_stock
node_stock -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_consecutive
node_consecutive -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_majority
node_majority -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_reverse_pairs
node_reverse_pairs -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_window
node_window -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_binary_search
node_binary_search -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_rotated_search
node_rotated_search -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_duplicate_search
node_duplicate_search -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_search_range
node_search_range -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_search_insert
node_search_insert -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_single_element
node_single_element -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_prefix
node_prefix -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_palindrome
node_palindrome -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_reverse_words
node_reverse_words -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_reverse_integer
node_reverse_integer -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_perfect_number
node_perfect_number -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_divisor_game
node_divisor_game -->|"returns result"| node_judge
node_judge -->|"supplies input"| node_add_integers
node_add_integers -->|"returns result"| node_judge

click node_two_sum "https://github.com/saiprasadpadhy/leetcode/blob/main/0001-two-sum/0001-two-sum.java"
click node_matrix_zeroes "https://github.com/saiprasadpadhy/leetcode/blob/main/0073-set-matrix-zeroes/0073-set-matrix-zeroes.java"
click node_stock "https://github.com/saiprasadpadhy/leetcode/blob/main/0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.java"
click node_consecutive "https://github.com/saiprasadpadhy/leetcode/blob/main/0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.java"
click node_majority "https://github.com/saiprasadpadhy/leetcode/blob/main/0229-majority-element-ii/0229-majority-element-ii.java"
click node_reverse_pairs "https://github.com/saiprasadpadhy/leetcode/blob/main/0493-reverse-pairs/0493-reverse-pairs.java"
click node_window "https://github.com/saiprasadpadhy/leetcode/blob/main/1004-max-consecutive-ones-iii/1004-max-consecutive-ones-iii.java"
click node_binary_search "https://github.com/saiprasadpadhy/leetcode/blob/main/0704-binary-search/0704-binary-search.java"
click node_rotated_search "https://github.com/saiprasadpadhy/leetcode/blob/main/0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.java"
click node_duplicate_search "https://github.com/saiprasadpadhy/leetcode/blob/main/0081-search-in-rotated-sorted-array-ii/0081-search-in-rotated-sorted-array-ii.java"
click node_search_range "https://github.com/saiprasadpadhy/leetcode/blob/main/0034-find-first-and-last-position-of-element-in-sorted-array/0034-find-first-and-last-position-of-element-in-sorted-array.java"
click node_search_insert "https://github.com/saiprasadpadhy/leetcode/blob/main/0035-search-insert-position/0035-search-insert-position.java"
click node_single_element "https://github.com/saiprasadpadhy/leetcode/blob/main/0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.java"
click node_prefix "https://github.com/saiprasadpadhy/leetcode/blob/main/0014-longest-common-prefix/0014-longest-common-prefix.java"
click node_palindrome "https://github.com/saiprasadpadhy/leetcode/blob/main/0125-valid-palindrome/0125-valid-palindrome.py"
click node_reverse_words "https://github.com/saiprasadpadhy/leetcode/blob/main/0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.java"
click node_reverse_integer "https://github.com/saiprasadpadhy/leetcode/blob/main/0007-reverse-integer/0007-reverse-integer.java"
click node_perfect_number "https://github.com/saiprasadpadhy/leetcode/blob/main/0507-perfect-number/0507-perfect-number.java"
click node_divisor_game "https://github.com/saiprasadpadhy/leetcode/blob/main/1025-divisor-game/1025-divisor-game.java"
click node_add_integers "https://github.com/saiprasadpadhy/leetcode/blob/main/2235-add-two-integers/2235-add-two-integers.java"

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_two_sum,node_matrix_zeroes,node_stock,node_consecutive,node_majority,node_reverse_pairs,node_window toneBlue
class node_binary_search,node_rotated_search,node_duplicate_search,node_search_range,node_search_insert,node_single_element toneAmber
class node_prefix,node_palindrome,node_reverse_words toneMint
class node_reverse_integer,node_perfect_number,node_divisor_game,node_add_integers toneRose
class node_judge toneIndigo
```

## Components

### Array algorithms

- [Two Sum](https://github.com/saiprasadpadhy/leetcode/blob/main/0001-two-sum/0001-two-sum.java): `0001-two-sum/0001-two-sum.java`
- [Matrix Zeroes](https://github.com/saiprasadpadhy/leetcode/blob/main/0073-set-matrix-zeroes/0073-set-matrix-zeroes.java): `0073-set-matrix-zeroes/0073-set-matrix-zeroes.java`
- [Stock Profit](https://github.com/saiprasadpadhy/leetcode/blob/main/0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.java): `0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.java`
- [Consecutive Sequence](https://github.com/saiprasadpadhy/leetcode/blob/main/0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.java): `0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.java`
- [Majority Elements](https://github.com/saiprasadpadhy/leetcode/blob/main/0229-majority-element-ii/0229-majority-element-ii.java): `0229-majority-element-ii/0229-majority-element-ii.java`
- [Reverse Pairs](https://github.com/saiprasadpadhy/leetcode/blob/main/0493-reverse-pairs/0493-reverse-pairs.java): `0493-reverse-pairs/0493-reverse-pairs.java`
- [Sliding Window](https://github.com/saiprasadpadhy/leetcode/blob/main/1004-max-consecutive-ones-iii/1004-max-consecutive-ones-iii.java): `1004-max-consecutive-ones-iii/1004-max-consecutive-ones-iii.java`

### Search algorithms

- [Binary Search](https://github.com/saiprasadpadhy/leetcode/blob/main/0704-binary-search/0704-binary-search.java): `0704-binary-search/0704-binary-search.java`
- [Rotated Search](https://github.com/saiprasadpadhy/leetcode/blob/main/0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.java): `0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.java`
- [Duplicate Search](https://github.com/saiprasadpadhy/leetcode/blob/main/0081-search-in-rotated-sorted-array-ii/0081-search-in-rotated-sorted-array-ii.java): `0081-search-in-rotated-sorted-array-ii/0081-search-in-rotated-sorted-array-ii.java`
- [Search Range](https://github.com/saiprasadpadhy/leetcode/blob/main/0034-find-first-and-last-position-of-element-in-sorted-array/0034-find-first-and-last-position-of-element-in-sorted-array.java): `0034-find-first-and-last-position-of-element-in-sorted-array/0034-find-first-and-last-position-of-element-in-sorted-array.java`
- [Search Insert](https://github.com/saiprasadpadhy/leetcode/blob/main/0035-search-insert-position/0035-search-insert-position.java): `0035-search-insert-position/0035-search-insert-position.java`
- [Single Element](https://github.com/saiprasadpadhy/leetcode/blob/main/0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.java): `0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.java`

### String algorithms

- [Common Prefix](https://github.com/saiprasadpadhy/leetcode/blob/main/0014-longest-common-prefix/0014-longest-common-prefix.java): `0014-longest-common-prefix/0014-longest-common-prefix.java`
- [Valid Palindrome](https://github.com/saiprasadpadhy/leetcode/blob/main/0125-valid-palindrome/0125-valid-palindrome.py): `0125-valid-palindrome/0125-valid-palindrome.py`
- [Reverse Words](https://github.com/saiprasadpadhy/leetcode/blob/main/0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.java): `0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.java`

### Math and games

- [Reverse Integer](https://github.com/saiprasadpadhy/leetcode/blob/main/0007-reverse-integer/0007-reverse-integer.java): `0007-reverse-integer/0007-reverse-integer.java`
- [Perfect Number](https://github.com/saiprasadpadhy/leetcode/blob/main/0507-perfect-number/0507-perfect-number.java): `0507-perfect-number/0507-perfect-number.java`
- [Divisor Game](https://github.com/saiprasadpadhy/leetcode/blob/main/1025-divisor-game/1025-divisor-game.java): `1025-divisor-game/1025-divisor-game.java`
- [Add Integers](https://github.com/saiprasadpadhy/leetcode/blob/main/2235-add-two-integers/2235-add-two-integers.java): `2235-add-two-integers/2235-add-two-integers.java`

### Other components

- **LeetCode judge**

## Connections

- LeetCode judge → Two Sum: supplies input
- Two Sum → LeetCode judge: returns result
- LeetCode judge → Matrix Zeroes: supplies input
- Matrix Zeroes → LeetCode judge: returns result
- LeetCode judge → Stock Profit: supplies input
- Stock Profit → LeetCode judge: returns result
- LeetCode judge → Consecutive Sequence: supplies input
- Consecutive Sequence → LeetCode judge: returns result
- LeetCode judge → Majority Elements: supplies input
- Majority Elements → LeetCode judge: returns result
- LeetCode judge → Reverse Pairs: supplies input
- Reverse Pairs → LeetCode judge: returns result
- LeetCode judge → Sliding Window: supplies input
- Sliding Window → LeetCode judge: returns result
- LeetCode judge → Binary Search: supplies input
- Binary Search → LeetCode judge: returns result
- LeetCode judge → Rotated Search: supplies input
- Rotated Search → LeetCode judge: returns result
- LeetCode judge → Duplicate Search: supplies input
- Duplicate Search → LeetCode judge: returns result
- LeetCode judge → Search Range: supplies input
- Search Range → LeetCode judge: returns result
- LeetCode judge → Search Insert: supplies input
- Search Insert → LeetCode judge: returns result
- LeetCode judge → Single Element: supplies input
- Single Element → LeetCode judge: returns result
- LeetCode judge → Common Prefix: supplies input
- Common Prefix → LeetCode judge: returns result
- LeetCode judge → Valid Palindrome: supplies input
- Valid Palindrome → LeetCode judge: returns result
- LeetCode judge → Reverse Words: supplies input
- Reverse Words → LeetCode judge: returns result
- LeetCode judge → Reverse Integer: supplies input
- Reverse Integer → LeetCode judge: returns result
- LeetCode judge → Perfect Number: supplies input
- Perfect Number → LeetCode judge: returns result
- LeetCode judge → Divisor Game: supplies input
- Divisor Game → LeetCode judge: returns result
- LeetCode judge → Add Integers: supplies input
- Add Integers → LeetCode judge: returns result
