LeetCodeAnimation Directory Structure for Problem Submissions: Complete Guide
The LeetCodeAnimation repository organizes every problem submission into a dedicated folder named <problem-id>-<slug> containing three standard subdirectories: Article/ for markdown explanations, Code/ for optional source files, and Animation/ for algorithm visualizations.
The MisterBooo/LeetCodeAnimation repository uses a modular, predictable directory structure for problem submissions that separates written explanations, raw code, and algorithm visualizations into distinct locations. This layout makes it simple to locate specific problem resources, generate animations programmatically, or contribute new solutions following established conventions.
Problem Folder Naming Convention
Every problem submission resides in its own top-level folder following a strict naming pattern: a four-digit zero-padded problem ID, a hyphen, and a short English slug.
Format: <problem-id>-<slug>
Examples from the source:
0001-Two-Sum(LeetCode #1)0011-maxArea(LeetCode #11 – Container With Most Water)0004-median-of-two-sorted-arrays(LeetCode #4)
This consistent naming scheme allows for alphabetical sorting that respects numerical order and makes folder identification unambiguous.
Standard Subdirectory Layout
Each problem folder contains up to three functional subdirectories that isolate content by type.
Article Directory
The Article/ subdirectory holds the primary educational content as a single markdown file. The filename matches the parent folder name exactly.
Example path:
0011-maxArea/Article/0011-maxArea.md
This file contains the full problem statement, algorithm analysis, complexity discussion, and embedded code snippets. According to the repository structure, this is the definitive human-readable explanation for the problem.
Code Directory (Optional)
The Code/ subdirectory stores raw source files for the solution implementations. This directory is optional and may contain multiple language versions.
Example path:
0004-median-of-two-sorted-arrays/Code/1.java
Files here are typically named simply (e.g., 1.java, Solution.py) and represent the executable implementations referenced in the accompanying article.
Animation Directory
The Animation/ subdirectory houses all visual assets that demonstrate the algorithm's execution. These assets are the distinguishing feature of the repository.
Example paths:
0011-maxArea/Animation/maxArea.gif
0011-maxArea/Animation/maxArea.mp4
These files are generated using the repository's animation pipeline and are designed to be embedded directly in documentation or web pages via raw GitHub URLs.
Supporting Directories and Meta Files
Beyond individual problem folders, the root contains shared infrastructure and reference material.
The notes/ Directory
Parallel to the problem folders, the notes/ directory stores concise Chinese-language markdown summaries for quick reference.
Example path:
notes/LeetCode第1号问题:两数之和.md
These files provide condensed explanations distinct from the full articles in the problem folders.
The anima/ Animation Engine
The anima/ directory contains the core Python library responsible for building algorithm visualizations.
Key source files:
anima/model.py– Defines data structures representing nodes and edges in the animation graphanima/create.py– Provides helpers for rendering GIF and MP4 files from algorithm stepsanima/base.py– Contains abstract base classes for animation renderers
These modules transform static code into the visual assets found in each problem's Animation/ folder.
Root Configuration Files
The repository root maintains several meta files that govern the project:
Readme.md– Project overview and animation generation instructionsREADME-En.md– English version of the documentationcontributing.md– Guidelines for submitting new problems following the directory conventionstemplate/template.md– Boilerplate template for creating new problem articlesrequirements.txt– Python dependencies (imageio,numpy) for running the animation pipeline
Programmatically Accessing Problem Submissions
You can navigate this directory structure programmatically to extract articles or list available problems.
List All Problem Folders (Python)
This script identifies all problem submissions by checking for the four-digit numeric prefix:
from pathlib import Path
repo_root = Path("/cache/repos/github.com/MisterBooo/LeetCodeAnimation/master")
problem_dirs = sorted(p for p in repo_root.iterdir()
if p.is_dir() and p.name[:4].isdigit())
for d in problem_dirs:
print(d.name) # e.g., 0001-Two-Sum
article = d / "Article" / f"{d.name}.md"
print(" article →", article)
Access Chinese Notes (Bash)
To retrieve the Chinese quick-reference for problem #1:
cat notes/LeetCode第1号问题:两数之和.md
Embed Animation Assets
The animation GIF for problem #11 can be referenced via direct raw URL:

Summary
- Problem folders use the strict naming convention
<problem-id>-<slug>(e.g.,0001-Two-Sum) to ensure consistent sorting and identification. - Three subdirectories standardize content organization:
Article/for markdown explanations,Code/for optional source files, andAnimation/for visual assets. - Chinese notes reside separately in
notes/as condensed reference material distinct from full articles. - Animation generation depends on the
anima/package (model.py,create.py,base.py) to produce the GIF and MP4 files stored in problem folders. - Root-level files including
contributing.mdandtemplate/template.mdenforce the directory structure standards for new submissions.
Frequently Asked Questions
How are problem folders named in LeetCodeAnimation?
Each folder follows the pattern <problem-id>-<slug> where the ID is a four-digit zero-padded number (e.g., 0001, 0011) and the slug is a descriptive English title (e.g., Two-Sum, maxArea). This creates paths like 0001-Two-Sum/ and 0011-maxArea/ that sort correctly by problem number.
What files are required inside each problem submission directory?
Only the Article/ subdirectory is mandatory, containing a markdown file named to match the folder (e.g., 0011-maxArea/Article/0011-maxArea.md). The Code/ and Animation/ directories are optional, though most submissions include animations as this is the repository's primary purpose.
Where are the Chinese language notes stored?
Chinese quick-reference notes are stored in the root-level notes/ directory, separate from the problem folders. These files follow a naming pattern like LeetCode第1号问题:两数之和.md and provide condensed explanations compared to the full articles.
How does the animation generation system work?
The animation system uses the anima/ Python package, specifically anima/model.py for graph data structures and anima/create.py for rendering GIF/MP4 outputs. These tools process algorithm steps into visual assets that are saved to each problem's Animation/ subdirectory as .gif or .mp4 files.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →