How haoel/leetcode works
This project is not a “server‐based” application but rather a well–organized repository of algorithm and data–structure problem solutions (primarily LeetCode, with a smattering of LintCode and shell challenges). In other words, it is a “learning” and “reference” repository that stores solutions in several programming languages, with separate modules for each language, along with documentation, automation scripts, and even a small “database” directory.
Main Components
• Repository Root – This top–level node includes files like .gitignore and README.md.
• Algorithms Module – The largest part of the repository. Under this node, include subcomponents representing different languages:
– C++ Solutions (algorithms/cpp) with each algorithm as its own sub–folder (for example “3Sum”, “LRUCache”, etc.).
– Java Solutions (algorithms/java) with further structure (for example “src”, “Test” files, etc.).
– Python Solutions (algorithms/python) with subdirectories for each problem.
– Go (Golang) Solutions (algorithms/golang).
• Database Module – Represented by the “database” folder that holds SQL scripts (for example TripsAndUsers.sql) and its README.
• Scripts Module – Under the “scripts” folder, which holds build/automation scripts (bash files for queries, git configuration, workflow scripts, etc.).
• Shell Module – Under the “shell” folder are several bash scripts solving LeetCode shell problems.
Relationships and Interactions
• Each sub–module under Algorithms (such as “cpp”, “java”, “python”, “golang”) has a hierarchical structure where each problem is kept in a dedicated sub–directory. It is useful to show how the Solutions are organized by problem number and title.
• The “scripts” and “shell” modules are independent tools that assist with additional tasks (such as workflow or quick challenges) and can be shown as parallel components connected to the repository root.
Architectural Patterns and Design Principles
• Hierarchical Structure: The repository is organized as a tree, where the root splits into several independent modules (Algorithms, Database, Scripts, Shell). Within Algorithms, further subdivisions exist by language and then by problem. This mirrors modular design.
• Multi–Language Support: The separation of solutions by language (C++, Java, Python, Go) is a key architectural choice. Each language sub–folder encapsulates similar types of problems (and testing code) so that introducing a new language or challenge is simplified.
• Documentation Integration: The README file acts as a dynamic index of problems with external links (to LeetCode, LintCode, etc.) that can be modeled as an external “documentation” or “external reference” node that feeds into the internal structure.