# mayongupta/leetcode architecture

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

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

## Overview

This repository is a catalog of standalone Python solutions to classic LeetCode problems, not an application that executes them as a service. The main workflow is to browse the documented index, choose a topic and solution, then paste its LeetCode-compatible class and method into the platform and use it to compute an answer. The graph preserves all 16 indexed problems and the shared linked-list/tree node definitions. Solution-to-solution calls are not shown; the sampled sources do not establish such relationships.

Main entry points: [`README.md`](https://github.com/mayongupta/leetcode/blob/main/README.md) (Solutions Index), [`problems/linked_list/reverse_linked_list.py`](https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/reverse_linked_list.py) (Reverse List), [`problems/linked_list/merge_k_sorted_lists.py`](https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/merge_k_sorted_lists.py) (Merge K Lists), [`problems/trees/binary_tree_level_order_traversal.py`](https://github.com/mayongupta/leetcode/blob/main/problems/trees/binary_tree_level_order_traversal.py) (Tree Level Order)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arrays["Arrays"]
  node_two_sum["Two Sum<br/>[two_sum.py]"]
  node_stock["Stock Profit"]
  node_max_subarray["Maximum Subarray"]
  node_median["Median Of Arrays"]
end

subgraph group_strings["Strings"]
  node_parentheses["Valid Parentheses"]
  node_substring["Longest Substring"]
end

subgraph group_lists_trees["Lists And Trees"]
  node_reverse_list["Reverse List"]
  node_merge_lists["Merge K Lists"]
  node_tree_levels["Tree Level Order"]
  node_node_types["Shared Node Types<br/>[data_structures.py]"]
end

subgraph group_dp["Dynamic Programming"]
  node_coin_change["Coin Change<br/>[coin_change.py]"]
  node_word_break["Word Break<br/>[word_break.py]"]
end

subgraph group_graphs["Graphs"]
  node_course_schedule["Course Schedule<br/>[course_schedule.py]"]
  node_islands["Number Of Islands"]
end

subgraph group_heaps_design["Heaps And Design"]
  node_kth_largest["Kth Largest"]
  node_lru["LRU Cache<br/>[lru_cache.py]"]
  node_intervals["Merge Intervals<br/>[merge_intervals.py]"]
end

node_user(("Problem Solver"))
node_index["Solutions Index<br/>[README.md]"]
node_answer(("Computed Answer"))

node_user -->|"browses"| node_index
node_index -->|"lists"| node_two_sum
node_index -->|"lists"| node_stock
node_index -->|"lists"| node_max_subarray
node_index -->|"lists"| node_median
node_index -->|"lists"| node_parentheses
node_index -->|"lists"| node_substring
node_index -->|"lists"| node_reverse_list
node_index -->|"lists"| node_merge_lists
node_index -->|"lists"| node_tree_levels
node_index -->|"lists"| node_coin_change
node_index -->|"lists"| node_word_break
node_index -->|"lists"| node_course_schedule
node_index -->|"lists"| node_islands
node_index -->|"lists"| node_kth_largest
node_index -->|"lists"| node_lru
node_index -->|"lists"| node_intervals
node_two_sum -->|"returns result"| node_answer
node_stock -->|"returns result"| node_answer
node_max_subarray -->|"returns result"| node_answer
node_median -->|"returns result"| node_answer
node_parentheses -->|"returns result"| node_answer
node_substring -->|"returns result"| node_answer
node_reverse_list -->|"returns result"| node_answer
node_merge_lists -->|"returns result"| node_answer
node_tree_levels -->|"returns result"| node_answer
node_coin_change -->|"returns result"| node_answer
node_word_break -->|"returns result"| node_answer
node_course_schedule -->|"returns result"| node_answer
node_islands -->|"returns result"| node_answer
node_kth_largest -->|"returns result"| node_answer
node_lru -->|"returns result"| node_answer
node_intervals -->|"returns result"| node_answer
node_reverse_list -->|"uses ListNode"| node_node_types
node_merge_lists -->|"uses ListNode"| node_node_types
node_tree_levels -->|"uses TreeNode"| node_node_types

click node_index "https://github.com/mayongupta/leetcode/blob/main/README.md"
click node_two_sum "https://github.com/mayongupta/leetcode/blob/main/problems/arrays/two_sum.py"
click node_stock "https://github.com/mayongupta/leetcode/blob/main/problems/arrays/best_time_to_buy_sell_stock.py"
click node_max_subarray "https://github.com/mayongupta/leetcode/blob/main/problems/arrays/maximum_subarray.py"
click node_median "https://github.com/mayongupta/leetcode/blob/main/problems/arrays/median_of_two_sorted_arrays.py"
click node_parentheses "https://github.com/mayongupta/leetcode/blob/main/problems/strings/valid_parentheses.py"
click node_substring "https://github.com/mayongupta/leetcode/blob/main/problems/strings/longest_substring_without_repeating.py"
click node_reverse_list "https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/reverse_linked_list.py"
click node_merge_lists "https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/merge_k_sorted_lists.py"
click node_tree_levels "https://github.com/mayongupta/leetcode/blob/main/problems/trees/binary_tree_level_order_traversal.py"
click node_node_types "https://github.com/mayongupta/leetcode/blob/main/utils/data_structures.py"
click node_coin_change "https://github.com/mayongupta/leetcode/blob/main/problems/dynamic_programming/coin_change.py"
click node_word_break "https://github.com/mayongupta/leetcode/blob/main/problems/dynamic_programming/word_break.py"
click node_course_schedule "https://github.com/mayongupta/leetcode/blob/main/problems/graphs/course_schedule.py"
click node_islands "https://github.com/mayongupta/leetcode/blob/main/problems/graphs/number_of_islands.py"
click node_kth_largest "https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/kth_largest_element.py"
click node_lru "https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/lru_cache.py"
click node_intervals "https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/merge_intervals.py"

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_stock,node_max_subarray,node_median toneBlue
class node_parentheses,node_substring toneAmber
class node_reverse_list,node_merge_lists,node_tree_levels,node_node_types toneMint
class node_coin_change,node_word_break toneRose
class node_course_schedule,node_islands,node_user,node_answer toneIndigo
class node_kth_largest,node_lru,node_intervals,node_index toneTeal
```

## Components

### Arrays

- [Two Sum](https://github.com/mayongupta/leetcode/blob/main/problems/arrays/two_sum.py): `problems/arrays/two_sum.py`
- [Stock Profit](https://github.com/mayongupta/leetcode/blob/main/problems/arrays/best_time_to_buy_sell_stock.py): `problems/arrays/best_time_to_buy_sell_stock.py`
- [Maximum Subarray](https://github.com/mayongupta/leetcode/blob/main/problems/arrays/maximum_subarray.py): `problems/arrays/maximum_subarray.py`
- [Median Of Arrays](https://github.com/mayongupta/leetcode/blob/main/problems/arrays/median_of_two_sorted_arrays.py): `problems/arrays/median_of_two_sorted_arrays.py`

### Strings

- [Valid Parentheses](https://github.com/mayongupta/leetcode/blob/main/problems/strings/valid_parentheses.py): `problems/strings/valid_parentheses.py`
- [Longest Substring](https://github.com/mayongupta/leetcode/blob/main/problems/strings/longest_substring_without_repeating.py): `problems/strings/longest_substring_without_repeating.py`

### Lists And Trees

- [Reverse List](https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/reverse_linked_list.py): `problems/linked_list/reverse_linked_list.py`
- [Merge K Lists](https://github.com/mayongupta/leetcode/blob/main/problems/linked_list/merge_k_sorted_lists.py): `problems/linked_list/merge_k_sorted_lists.py`
- [Tree Level Order](https://github.com/mayongupta/leetcode/blob/main/problems/trees/binary_tree_level_order_traversal.py): `problems/trees/binary_tree_level_order_traversal.py`
- [Shared Node Types](https://github.com/mayongupta/leetcode/blob/main/utils/data_structures.py): `utils/data_structures.py`

### Dynamic Programming

- [Coin Change](https://github.com/mayongupta/leetcode/blob/main/problems/dynamic_programming/coin_change.py): `problems/dynamic_programming/coin_change.py`
- [Word Break](https://github.com/mayongupta/leetcode/blob/main/problems/dynamic_programming/word_break.py): `problems/dynamic_programming/word_break.py`

### Graphs

- [Course Schedule](https://github.com/mayongupta/leetcode/blob/main/problems/graphs/course_schedule.py): `problems/graphs/course_schedule.py`
- [Number Of Islands](https://github.com/mayongupta/leetcode/blob/main/problems/graphs/number_of_islands.py): `problems/graphs/number_of_islands.py`

### Heaps And Design

- [Kth Largest](https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/kth_largest_element.py): `problems/heaps_and_intervals/kth_largest_element.py`
- [LRU Cache](https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/lru_cache.py): `problems/heaps_and_intervals/lru_cache.py`
- [Merge Intervals](https://github.com/mayongupta/leetcode/blob/main/problems/heaps_and_intervals/merge_intervals.py): `problems/heaps_and_intervals/merge_intervals.py`

### Other components

- **Problem Solver**
- [Solutions Index](https://github.com/mayongupta/leetcode/blob/main/README.md): `README.md`
- **Computed Answer**

## Connections

- Problem Solver → Solutions Index: browses (evidence: `README.md`)
- Solutions Index → Two Sum: lists (evidence: `README.md`)
- Solutions Index → Stock Profit: lists (evidence: `README.md`)
- Solutions Index → Maximum Subarray: lists (evidence: `README.md`)
- Solutions Index → Median Of Arrays: lists (evidence: `README.md`)
- Solutions Index → Valid Parentheses: lists (evidence: `README.md`)
- Solutions Index → Longest Substring: lists (evidence: `README.md`)
- Solutions Index → Reverse List: lists (evidence: `README.md`)
- Solutions Index → Merge K Lists: lists (evidence: `README.md`)
- Solutions Index → Tree Level Order: lists (evidence: `README.md`)
- Solutions Index → Coin Change: lists (evidence: `README.md`)
- Solutions Index → Word Break: lists (evidence: `README.md`)
- Solutions Index → Course Schedule: lists (evidence: `README.md`)
- Solutions Index → Number Of Islands: lists (evidence: `README.md`)
- Solutions Index → Kth Largest: lists (evidence: `README.md`)
- Solutions Index → LRU Cache: lists (evidence: `README.md`)
- Solutions Index → Merge Intervals: lists (evidence: `README.md`)
- Two Sum → Computed Answer: returns result (evidence: `README.md`)
- Stock Profit → Computed Answer: returns result (evidence: `README.md`)
- Maximum Subarray → Computed Answer: returns result (evidence: `README.md`)
- Median Of Arrays → Computed Answer: returns result (evidence: `problems/arrays/median_of_two_sorted_arrays.py`)
- Valid Parentheses → Computed Answer: returns result (evidence: `README.md`)
- Longest Substring → Computed Answer: returns result (evidence: `problems/strings/longest_substring_without_repeating.py`)
- Reverse List → Computed Answer: returns result (evidence: `problems/linked_list/reverse_linked_list.py`)
- Merge K Lists → Computed Answer: returns result (evidence: `problems/linked_list/merge_k_sorted_lists.py`)
- Tree Level Order → Computed Answer: returns result (evidence: `problems/trees/binary_tree_level_order_traversal.py`)
- Coin Change → Computed Answer: returns result (evidence: `README.md`)
- Word Break → Computed Answer: returns result (evidence: `problems/dynamic_programming/word_break.py`)
- Course Schedule → Computed Answer: returns result (evidence: `problems/graphs/course_schedule.py`)
- Number Of Islands → Computed Answer: returns result (evidence: `problems/graphs/number_of_islands.py`)
- Kth Largest → Computed Answer: returns result (evidence: `README.md`)
- LRU Cache → Computed Answer: returns result (evidence: `problems/heaps_and_intervals/lru_cache.py`)
- Merge Intervals → Computed Answer: returns result (evidence: `problems/heaps_and_intervals/merge_intervals.py`)
- Reverse List → Shared Node Types: uses ListNode (evidence: `problems/linked_list/reverse_linked_list.py`)
- Merge K Lists → Shared Node Types: uses ListNode (evidence: `problems/linked_list/merge_k_sorted_lists.py`)
- Tree Level Order → Shared Node Types: uses TreeNode (evidence: `problems/trees/binary_tree_level_order_traversal.py`)
