How akshatsinghnayal/leetcode works
1. This repository is a problem-solution archive, not an application. It primarily contains LeetCode and interview-practice answers, generated with LeetHub v2 and organized as a catalog of independent algorithm implementations.
2. The main top-level subsystem is the LeetCode collection: folders named by problem number and slug, such as 0001-two-sum, 0207-course-schedule, or 3946-maximum-number-of-items-from-sale-i. Each folder is a self-contained solution unit.
3. Inside most LeetCode folders there are two artifacts:
- a C++ source file with the same problem slug
- a local README.md containing the problem statement or notes
A few problems have only a README, indicating missing or not-yet-committed code.
4. The second major subsystem is a categorized interview-practice area under Difficulty/. This is split into Basic, Easy, Medium, and Hard, and then further into named problem folders. These are also independent solution units, but they follow a different naming scheme from the LeetCode-numbered archive.
5. The codebase is intentionally flat and modular at the folder level. There is no visible shared library, service layer, test harness, or cross-folder dependency graph. Architecture-wise, every folder stands alone and solves one problem in isolation.
6. Languages are problem-driven rather than system-driven. Most implementations are in C++, reflecting algorithmic interview practice. A small number of SQL problems are included as .sql files, which are separate from the C++ problem set and represent database-query solutions.
7. The repository root README.md acts as an index rather than documentation for a runtime system. It enumerates LeetCode topics and links each topic to the corresponding problem folder. This creates a taxonomy layer across the independent solutions.
8. The topic index is the most important “architecture” layer beyond folders. Problems are grouped by algorithmic patterns such as Array, String, Linked List, Tree, Graph, Dynamic Programming, Greedy, Heap, Binary Search, Stack, Sliding Window, and others. For a diagram, this is a many-to-many classification map from problem folders to topics.
9. Several problems appear under multiple topics, which is expected for algorithm exercises. For example, a single solution may belong to both “Tree” and “Depth-First Search,” or both “Array” and “Two Pointers.” The repository is therefore better modeled as a tagged solution corpus than a hierarchical app.
10. The stats.json file likely serves as repository metadata/summary generated by tooling rather than by the solutions themselves. It is a supporting artifact, not part of the solution execution path.
11. There is no runtime data flow between problems. The only real flow is external: LeetCode problem statement → local README/source file → optional metadata classification in the root README. No services, APIs, databases, or queues are part of the solution architecture.
12. The clean architectural boundary is therefore: problem folder = unit of implementation; root README = index and taxonomy; Difficulty/ = alternate categorization for non-LeetCode practice; SQL files = separate query-solution branch. An accurate diagram should emphasize catalog structure, classification overlays, and the absence of shared execution dependencies.
Main entry points: README.md Topic Index · Difficulty: Basic Difficulty/ · Difficulty: Easy Easy · Difficulty: Medium Medium
Components 21
Repository Root
Top-level index and metadata files.
- README.md · Repository index and taxonomy entry point.
README.md - stats.json · Generated repository summary data.
stats.json - Topic Index · Algorithm-pattern classification used to group solutions.
README.md
LeetCode Archive
Numbered problem folders with independent algorithm solutions.
- LeetCode Archive · Flat archive of numbered problem folders.
- Array/Hash · Representative set of array, hashing, and prefix-sum style problems.
0001-two-sum - Pointers · Representative two-pointer and sliding-window style problems.
0011-container-with-most-water - Linked Lists · Representative list-manipulation solutions.
0019-remove-nth-node-from-end-of-list - Trees · Representative binary-tree and BST solutions.
0094-binary-tree-inorder-traversal - Graphs · Representative graph traversal and shortest-path solutions.
0207-course-schedule - DP · Representative dynamic-programming solutions.
0120-triangle
Interview Practice
Categorized practice problems under Difficulty/.
- Difficulty/ · Categorized interview-practice solution area.
Difficulty: Basic - Basic · Entry-level practice problems.
Difficulty: Basic - Easy · Easy practice problems across classic data structures and graph basics.
Difficulty: Easy - Medium · Core interview-practice algorithms and data-structure patterns.
Difficulty: Medium - Hard · Advanced practice problems.
Difficulty: Hard - Odd or Even · Representative Basic folder with a single solution file.
Difficulty: Basic/Odd or Even - BFS Graph · Representative Easy graph traversal folder.
Difficulty: Easy/BFS of graph - Knapsack · Representative Medium dynamic-programming folder.
Difficulty: Medium/0 - 1 Knapsack Problem - LCS Sequences · Representative Hard folder.
Difficulty: Hard/Print all LCS sequences
SQL Solutions
Standalone database-query problem solutions.
- SQL Branch · Standalone SQL-based LeetCode solutions.
0595-big-countries - Big Countries · Representative SQL query solution folder.
0595-big-countries
Connections 26
- README.md → Topic Index: indexes · Root README provides the taxonomy layer for the archive.
- README.md → LeetCode Archive: links · Root README points into the numbered problem archive.
- README.md → Difficulty/: references · Root README also covers the interview-practice catalog.
- README.md → SQL Branch: mentions · Root README includes the SQL-solution branch.
- stats.json → README.md: summarizes · Metadata is supporting repository summary information.
- Topic Index → Array/Hash: tags · Topics classify independent problems by algorithmic pattern.
- Topic Index → Pointers: tags · Problems may appear in multiple topical categories.
- Topic Index → Linked Lists: tags · List problems are cross-tagged by technique.
- Topic Index → Trees: tags · Tree problems are cross-tagged by traversal and structure.
- Topic Index → Graphs: tags · Graph problems are cross-tagged by traversal and topology.
- Topic Index → DP: tags · Dynamic-programming problems are tagged alongside their pattern.
- LeetCode Archive → Array/Hash: contains · Numbered folders are self-contained solution units.
- LeetCode Archive → Pointers: contains · Archive spans many independent algorithm implementations.
- LeetCode Archive → Linked Lists: contains · List solution folders stand alone without shared dependencies.
- LeetCode Archive → Trees: contains · Tree solution folders stand alone without shared dependencies.
- LeetCode Archive → Graphs: contains · Graph solution folders stand alone without shared dependencies.
- LeetCode Archive → DP: contains · DP solution folders stand alone without shared dependencies.
- Difficulty/ → Basic: organizes · Difficulty/ is subdivided into bands.
- Difficulty/ → Easy: organizes · Difficulty/ is subdivided into bands.
- Difficulty/ → Medium: organizes · Difficulty/ is subdivided into bands.
- Difficulty/ → Hard: organizes · Difficulty/ is subdivided into bands.
- Basic → Odd or Even: contains · Representative basic practice folder.
- Easy → BFS Graph: contains · Representative easy practice folder.
- Medium → Knapsack: contains · Representative medium practice folder.
- Hard → LCS Sequences: contains · Representative hard practice folder.
- SQL Branch → Big Countries: contains · SQL problems are separate from the C++ archive.