# prathamesh612/coding-challenges architecture

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

- Interactive diagram: https://gitdiagram.com/prathamesh612/coding-challenges
- Repository: https://github.com/prathamesh612/coding-challenges

## Overview

1. This repository is not a single application; it is a catalog of 88 independent Java coding-challenge solutions. The architectural boundary is the problem folder: each `problem-XX-*` directory is a self-contained unit with its own README and one Java source file, or in a few cases multiple alternative solution files.

2. The root `README.md` is the entry point and index. It provides the problem list, difficulty labels, repository goals, and the shared execution model. For an architecture diagram, treat the root as documentation and navigation only, not as an executable subsystem.

3. Execution is strictly local and per-problem. The documented runtime flow is: enter one problem directory, compile the single `.java` file with `javac`, then run it with `java`. There is no global build tool, dependency manager, test harness, or multi-module orchestration visible in the repository.

4. The solution code is organized by algorithmic domain rather than by application feature. Most folders correspond to classic interview/problem categories: string manipulation, array operations, numeric checks, parsing/validation, dynamic programming, graph/grid traversal, and backtracking.

5. A large portion of the repo is string and text processing: examples include vowel checks, anagram detection, acronym building, sentence reversal/capitalization, HTML stripping, email/IP validation, camelCase conversion, password strength, and substring problems. These are independent implementations that do not share utility code.

6. Another major cluster is array and matrix algorithms: merge intervals, matrix rotation, spiral matrix, set matrix zeroes, search in sorted matrix, sort colors, move zeroes, top-k frequent elements, two-sum, three-sum, and duplicate detection. These folders represent the “array processing” subsystem in the repo’s conceptual architecture.

7. There is a distinct dynamic programming / optimization cluster: coin change variants, subset sum, knapsack, house robber, longest common subsequence, edit distance, Fibonacci DP, merge stones, split array largest sum, and number of islands. These problems are standalone but thematically related by stateful recurrence or search/optimization logic.

8. Search, greedy, and pointer-based problems form another group: peak finding, gas station, jump game, activity selection, Koko eating bananas, container with most water, trapping rain water, rotated array search, and first/last position lookup. These solutions likely emphasize invariant-driven traversal and binary search patterns.

9. Backtracking and combinatorial generation appear in folders like N-Queens, subsets, and generate parentheses, with tree/grid traversal in binary tree paths and number of islands. These are separate problem-specific exploration engines rather than shared framework components.

10. The repository has no apparent external services, persistence layer, API layer, or frontend. Its only real dependency is the Java standard library plus the local JDK used to compile and run each file. That means the architecture diagram should show a flat set of isolated compute units under a documentation/index layer.

11. A few folders contain multiple implementations of the same problem, such as `SecondBest1.java` and `SecondBest2.java`. Those should be modeled as alternate solution variants within the same problem boundary, not as separate subsystems.

12. The main cross-cutting concern is consistency of structure: each problem folder contains its own problem statement and solution code, and the root README aggregates status and links. In other words, the repo is a practice library of independent algorithm modules with zero runtime coupling between them.

Main entry points: [`README.md`](https://github.com/prathamesh612/coding-challenges/blob/main/README.md) (Root README), [`problem-01-vowel-balance/VowelBalance.java`](https://github.com/prathamesh612/coding-challenges/blob/main/problem-01-vowel-balance/VowelBalance.java) (Vowel Balance), [`problem-14-camelcase-converter/CamelCaseConverter.java`](https://github.com/prathamesh612/coding-challenges/blob/main/problem-14-camelcase-converter/CamelCaseConverter.java) (CamelCase), [`problem-26-acronym-builder/AcronymBuilder.java`](https://github.com/prathamesh612/coding-challenges/blob/main/problem-26-acronym-builder/AcronymBuilder.java) (Acronym Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Docs & Index"]
  node_root_readme["Root README<br/>index/docs<br/>[README.md]"]
  node_problem_pattern["Problem Folders<br/>repo pattern"]
end

subgraph group_text["String & Text"]
  node_text_cluster["Text Problems<br/>problem cluster"]
  node_problem_01["Vowel Balance<br/>string<br/>[VowelBalance.java]"]
  node_problem_14["CamelCase<br/>string transform"]
  node_problem_26["Acronym Builder<br/>string transform"]
  node_problem_36["Password Strength<br/>validation"]
  node_problem_38["HTML Strip<br/>text parsing"]
  node_problem_39["Email Validator<br/>validation"]
  node_problem_23["IPv4 Validator<br/>validation<br/>[IPv4Validator.java]"]
end

subgraph group_arrays["Arrays & Matrices"]
  node_array_cluster["Array Problems<br/>problem cluster"]
  node_problem_28["Array Diff<br/>array filter<br/>[ArrayDiff.java]"]
  node_problem_45["Merge Intervals"]
  node_problem_50["Top K Frequent<br/>frequency"]
  node_problem_24["Rotate Matrix<br/>matrix transform<br/>[MatrixRotate.java]"]
  node_problem_46["Spiral Matrix<br/>matrix traversal<br/>[SpiralMatrix.java]"]
  node_problem_48["Search Matrix<br/>matrix search"]
  node_problem_65["Set Zeroes<br/>matrix transform"]
end

subgraph group_dp["DP & Optimization"]
  node_dp_cluster["DP Problems<br/>problem cluster"]
  node_problem_52["Coin Ways<br/>dp"]
  node_problem_53["Coin Min<br/>dp<br/>[CoinChangeMin.java]"]
  node_problem_55["Knapsack<br/>dp<br/>[Knapsack.java]"]
  node_problem_59["LCS<br/>dp"]
  node_problem_77["Edit Distance<br/>dp<br/>[EditDistance.java]"]
  node_problem_87["Split Array<br/>dp/search"]
end

subgraph group_search["Search & Greedy"]
  node_search_cluster["Search Problems<br/>problem cluster"]
  node_problem_80["Jump Game<br/>greedy<br/>[JumpGame.java]"]
  node_problem_85["Koko Bananas<br/>binary search"]
  node_problem_83["Rotated Search<br/>binary search"]
  node_problem_66["Peak Element<br/>binary search"]
end

subgraph group_comb["Backtracking & Traversal"]
  node_comb_cluster["Traversal Problems<br/>problem cluster"]
  node_problem_71["Subsets<br/>backtracking<br/>[Subsets.java]"]
  node_problem_72["N-Queens<br/>backtracking<br/>[NQueens.java]"]
end

subgraph group_math["Math & Numbers"]
  node_math_cluster["Numeric Problems<br/>problem cluster"]
end

node_root_readme -->|"documents"| node_problem_pattern
node_root_readme -->|"indexes"| node_text_cluster
node_root_readme -->|"indexes"| node_array_cluster
node_root_readme -->|"indexes"| node_dp_cluster
node_root_readme -->|"indexes"| node_search_cluster
node_root_readme -->|"indexes"| node_comb_cluster
node_root_readme -->|"indexes"| node_math_cluster
node_text_cluster -->|"includes"| node_problem_01
node_text_cluster -->|"includes"| node_problem_14
node_text_cluster -->|"includes"| node_problem_26
node_text_cluster -->|"includes"| node_problem_36
node_text_cluster -->|"includes"| node_problem_38
node_text_cluster -->|"includes"| node_problem_39
node_text_cluster -->|"includes"| node_problem_23
node_array_cluster -->|"includes"| node_problem_28
node_array_cluster -->|"includes"| node_problem_45
node_array_cluster -->|"includes"| node_problem_50
node_array_cluster -->|"includes"| node_problem_24
node_array_cluster -->|"includes"| node_problem_46
node_array_cluster -->|"includes"| node_problem_48
node_array_cluster -->|"includes"| node_problem_65
node_dp_cluster -->|"includes"| node_problem_52
node_dp_cluster -->|"includes"| node_problem_53
node_dp_cluster -->|"includes"| node_problem_55
node_dp_cluster -->|"includes"| node_problem_59
node_dp_cluster -->|"includes"| node_problem_77
node_dp_cluster -->|"includes"| node_problem_87
node_search_cluster -->|"includes"| node_problem_80
node_search_cluster -->|"includes"| node_problem_85
node_search_cluster -->|"includes"| node_problem_83
node_search_cluster -->|"includes"| node_problem_66
node_comb_cluster -->|"includes"| node_problem_71
node_comb_cluster -->|"includes"| node_problem_72

click node_root_readme "https://github.com/prathamesh612/coding-challenges/blob/main/README.md"
click node_problem_01 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-01-vowel-balance/VowelBalance.java"
click node_problem_14 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-14-camelcase-converter/CamelCaseConverter.java"
click node_problem_26 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-26-acronym-builder/AcronymBuilder.java"
click node_problem_36 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-36-password-strength/Passw0rdStr3ngth.java"
click node_problem_38 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-38-html-tag-stripper/HtmlTagStripper.java"
click node_problem_39 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-39-email-validator/EmailValidator.java"
click node_problem_23 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-23-ipv4-validator/IPv4Validator.java"
click node_problem_28 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-28-array-diff/ArrayDiff.java"
click node_problem_45 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-45-merge-intervals/MergeIntervals.java"
click node_problem_50 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-50-top-k-frequent/TopKFrequentElements.java"
click node_problem_24 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-24-matrix-rotate/MatrixRotate.java"
click node_problem_46 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-46-spiral-matrix/SpiralMatrix.java"
click node_problem_48 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-48-search-sorted-matrix/SearchInSortedMatrix.java"
click node_problem_65 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-65-set-matrix-zeroes/SetMatrixZeroes.java"
click node_problem_52 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-52-coin-change-ways/CoinChangeWays.java"
click node_problem_53 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-53-coin-change-min/CoinChangeMin.java"
click node_problem_55 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-55-knapsack/Knapsack.java"
click node_problem_59 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-59-longest-common-subsequence/LongestCommonSubsequence.java"
click node_problem_77 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-77-edit-distance/EditDistance.java"
click node_problem_87 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-87-split-array-largest-sum/SplitArrayLargestSum.java"
click node_problem_80 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-80-jump-game/JumpGame.java"
click node_problem_85 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-85-koko-eating-bananas/KokoEatingBananas.java"
click node_problem_83 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-83-search-rotated-sorted-array/SearchRotatedSortedArray.java"
click node_problem_66 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-66-find-peak-element/FindPeakElement.java"
click node_problem_71 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-71-subsets/Subsets.java"
click node_problem_72 "https://github.com/prathamesh612/coding-challenges/blob/main/problem-72-n-queens/NQueens.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_root_readme,node_problem_pattern,node_math_cluster toneBlue
class node_text_cluster,node_problem_01,node_problem_14,node_problem_26,node_problem_36,node_problem_38,node_problem_39,node_problem_23 toneAmber
class node_array_cluster,node_problem_28,node_problem_45,node_problem_50,node_problem_24,node_problem_46,node_problem_48,node_problem_65 toneMint
class node_dp_cluster,node_problem_52,node_problem_53,node_problem_55,node_problem_59,node_problem_77,node_problem_87 toneRose
class node_search_cluster,node_problem_80,node_problem_85,node_problem_83,node_problem_66 toneIndigo
class node_comb_cluster,node_problem_71,node_problem_72 toneTeal
```

## Components

### Docs & Index

Repository entry points and shared usage guidance.

- [Root README](https://github.com/prathamesh612/coding-challenges/blob/main/README.md): index/docs · Repository index, goals, and per-problem compile/run workflow. · `README.md`
- **Problem Folders**: repo pattern · Each problem directory is a self-contained Java solution boundary.

### String & Text

String manipulation, parsing, formatting, and validation challenges.

- **Text Problems**: problem cluster · Independent string manipulation, tokenization, validation, and formatting challenges.
- [Vowel Balance](https://github.com/prathamesh612/coding-challenges/blob/main/problem-01-vowel-balance/VowelBalance.java): string · Vowel-oriented text check. · `problem-01-vowel-balance/VowelBalance.java`
- [CamelCase](https://github.com/prathamesh612/coding-challenges/blob/main/problem-14-camelcase-converter/CamelCaseConverter.java): string transform · Token-to-camel-case conversion. · `problem-14-camelcase-converter/CamelCaseConverter.java`
- [Acronym Builder](https://github.com/prathamesh612/coding-challenges/blob/main/problem-26-acronym-builder/AcronymBuilder.java): string transform · Builds acronyms from phrases. · `problem-26-acronym-builder/AcronymBuilder.java`
- [Password Strength](https://github.com/prathamesh612/coding-challenges/blob/main/problem-36-password-strength/Passw0rdStr3ngth.java): validation · Password policy and strength checking. · `problem-36-password-strength/Passw0rdStr3ngth.java`
- [HTML Strip](https://github.com/prathamesh612/coding-challenges/blob/main/problem-38-html-tag-stripper/HtmlTagStripper.java): text parsing · Removes HTML-like tags from text. · `problem-38-html-tag-stripper/HtmlTagStripper.java`
- [Email Validator](https://github.com/prathamesh612/coding-challenges/blob/main/problem-39-email-validator/EmailValidator.java): validation · Email format validation. · `problem-39-email-validator/EmailValidator.java`
- [IPv4 Validator](https://github.com/prathamesh612/coding-challenges/blob/main/problem-23-ipv4-validator/IPv4Validator.java): validation · IPv4 address validation. · `problem-23-ipv4-validator/IPv4Validator.java`

### Arrays & Matrices

Array transforms, matrix operations, and interval-style problems.

- **Array Problems**: problem cluster · Array processing, interval handling, and matrix-oriented solutions.
- [Array Diff](https://github.com/prathamesh612/coding-challenges/blob/main/problem-28-array-diff/ArrayDiff.java): array filter · Array difference and filtering. · `problem-28-array-diff/ArrayDiff.java`
- [Merge Intervals](https://github.com/prathamesh612/coding-challenges/blob/main/problem-45-merge-intervals/MergeIntervals.java): intervals · Combines overlapping ranges. · `problem-45-merge-intervals/MergeIntervals.java`
- [Top K Frequent](https://github.com/prathamesh612/coding-challenges/blob/main/problem-50-top-k-frequent/TopKFrequentElements.java): frequency · Frequency-based selection from arrays. · `problem-50-top-k-frequent/TopKFrequentElements.java`
- [Rotate Matrix](https://github.com/prathamesh612/coding-challenges/blob/main/problem-24-matrix-rotate/MatrixRotate.java): matrix transform · In-place matrix rotation. · `problem-24-matrix-rotate/MatrixRotate.java`
- [Spiral Matrix](https://github.com/prathamesh612/coding-challenges/blob/main/problem-46-spiral-matrix/SpiralMatrix.java): matrix traversal · Layered matrix walk. · `problem-46-spiral-matrix/SpiralMatrix.java`
- [Search Matrix](https://github.com/prathamesh612/coding-challenges/blob/main/problem-48-search-sorted-matrix/SearchInSortedMatrix.java): matrix search · Searches sorted 2D matrix structure. · `problem-48-search-sorted-matrix/SearchInSortedMatrix.java`
- [Set Zeroes](https://github.com/prathamesh612/coding-challenges/blob/main/problem-65-set-matrix-zeroes/SetMatrixZeroes.java): matrix transform · Matrix zero propagation. · `problem-65-set-matrix-zeroes/SetMatrixZeroes.java`

### DP & Optimization

Dynamic programming, recurrence, and optimization problems.

- **DP Problems**: problem cluster · Stateful recurrence, optimization, and subset-style problems.
- [Coin Ways](https://github.com/prathamesh612/coding-challenges/blob/main/problem-52-coin-change-ways/CoinChangeWays.java): dp · Counts change-making combinations. · `problem-52-coin-change-ways/CoinChangeWays.java`
- [Coin Min](https://github.com/prathamesh612/coding-challenges/blob/main/problem-53-coin-change-min/CoinChangeMin.java): dp · Minimizes coins for a target sum. · `problem-53-coin-change-min/CoinChangeMin.java`
- [Knapsack](https://github.com/prathamesh612/coding-challenges/blob/main/problem-55-knapsack/Knapsack.java): dp · 0/1 optimization over capacity. · `problem-55-knapsack/Knapsack.java`
- [LCS](https://github.com/prathamesh612/coding-challenges/blob/main/problem-59-longest-common-subsequence/LongestCommonSubsequence.java): dp · Longest common subsequence. · `problem-59-longest-common-subsequence/LongestCommonSubsequence.java`
- [Edit Distance](https://github.com/prathamesh612/coding-challenges/blob/main/problem-77-edit-distance/EditDistance.java): dp · String transformation DP. · `problem-77-edit-distance/EditDistance.java`
- [Split Array](https://github.com/prathamesh612/coding-challenges/blob/main/problem-87-split-array-largest-sum/SplitArrayLargestSum.java): dp/search · Minimizes the largest partition sum. · `problem-87-split-array-largest-sum/SplitArrayLargestSum.java`

### Search & Greedy

Binary search, greedy traversal, and pointer-driven selection.

- **Search Problems**: problem cluster · Binary search, greedy feasibility, and traversal-driven selection.
- [Jump Game](https://github.com/prathamesh612/coding-challenges/blob/main/problem-80-jump-game/JumpGame.java): greedy · Reachability via forward scan. · `problem-80-jump-game/JumpGame.java`
- [Koko Bananas](https://github.com/prathamesh612/coding-challenges/blob/main/problem-85-koko-eating-bananas/KokoEatingBananas.java): binary search · Feasibility search over eating speed. · `problem-85-koko-eating-bananas/KokoEatingBananas.java`
- [Rotated Search](https://github.com/prathamesh612/coding-challenges/blob/main/problem-83-search-rotated-sorted-array/SearchRotatedSortedArray.java): binary search · Search in rotated sorted array. · `problem-83-search-rotated-sorted-array/SearchRotatedSortedArray.java`
- [Peak Element](https://github.com/prathamesh612/coding-challenges/blob/main/problem-66-find-peak-element/FindPeakElement.java): binary search · Finds a local peak in an array. · `problem-66-find-peak-element/FindPeakElement.java`

### Backtracking & Traversal

Combinatorial generation and graph/tree traversal problems.

- **Traversal Problems**: problem cluster · Backtracking and exploration over sets, trees, and grids.
- [Subsets](https://github.com/prathamesh612/coding-challenges/blob/main/problem-71-subsets/Subsets.java): backtracking · Generates all subset combinations. · `problem-71-subsets/Subsets.java`
- [N-Queens](https://github.com/prathamesh612/coding-challenges/blob/main/problem-72-n-queens/NQueens.java): backtracking · Places queens under board constraints. · `problem-72-n-queens/NQueens.java`

### Math & Numbers

Arithmetic checks, numeric sequences, and number-theory style tasks.

- **Numeric Problems**: problem cluster · Arithmetic checks, sequences, and classic numeric tasks.

## Connections

- Root README → Problem Folders: documents · Explains the local compile-and-run workflow.
- Root README → Text Problems: indexes · Lists text-focused challenge solutions.
- Root README → Array Problems: indexes · Lists array and matrix solution folders.
- Root README → DP Problems: indexes · Lists dynamic programming and optimization problems.
- Root README → Search Problems: indexes · Lists search and greedy-style problems.
- Root README → Traversal Problems: indexes · Lists backtracking and traversal problems.
- Root README → Numeric Problems: indexes · Documents numeric practice problems.
- Text Problems → Vowel Balance: includes · Example string challenge.
- Text Problems → CamelCase: includes · CamelCase conversion.
- Text Problems → Acronym Builder: includes · Acronym construction.
- Text Problems → Password Strength: includes · Password strength validation.
- Text Problems → HTML Strip: includes · HTML-like tag stripping.
- Text Problems → Email Validator: includes · Email validation.
- Text Problems → IPv4 Validator: includes · IPv4 validation.
- Array Problems → Array Diff: includes · Array diff/filtering.
- Array Problems → Merge Intervals: includes · Interval merging.
- Array Problems → Top K Frequent: includes · Top-k frequency selection.
- Array Problems → Rotate Matrix: includes · Matrix rotation.
- Array Problems → Spiral Matrix: includes · Spiral traversal.
- Array Problems → Search Matrix: includes · Matrix search.
- Array Problems → Set Zeroes: includes · Set-zeroes transform.
- DP Problems → Coin Ways: includes · Counting combinations.
- DP Problems → Coin Min: includes · Minimum-coin optimization.
- DP Problems → Knapsack: includes · Capacity optimization.
- DP Problems → LCS: includes · Subsequence recurrence.
- DP Problems → Edit Distance: includes · Edit distance DP.
- DP Problems → Split Array: includes · Partition minimization.
- Search Problems → Jump Game: includes · Forward reachability scan.
- Search Problems → Koko Bananas: includes · Binary-search feasibility.
- Search Problems → Rotated Search: includes · Rotated-array search.
- Search Problems → Peak Element: includes · Peak-finding search.
- Traversal Problems → Subsets: includes · Subset generation.
- Traversal Problems → N-Queens: includes · Constraint-based board search.
