# LeetCodeAnimation Directory Structure for Problem Submissions: Complete Guide

> Understand the LeetCodeAnimation directory structure for problem submissions. Explore Article/, Code/, and Animation/ folders in the MisterBooo/LeetCodeAnimation repo to access explanations, code, and visualizations.

- Repository: [吴师兄学算法/LeetCodeAnimation](https://github.com/MisterBooo/LeetCodeAnimation)
- Tags: how-to-guide
- Published: 2026-03-01

---

**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:**

```text
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:**

```text
0004-median-of-two-sorted-arrays/Code/1.java

```

Files here are typically named simply (e.g., [`1.java`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/1.java), [`Solution.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/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:**

```text
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:**

```text
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`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/model.py) – Defines data structures representing nodes and edges in the animation graph
- [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/create.py) – Provides helpers for rendering GIF and MP4 files from algorithm steps
- [`anima/base.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/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`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/Readme.md) – Project overview and animation generation instructions
- [`README-En.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/README-En.md) – English version of the documentation
- [`contributing.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/contributing.md) – Guidelines for submitting new problems following the directory conventions
- [`template/template.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/template/template.md) – Boilerplate template for creating new problem articles
- [`requirements.txt`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/requirements.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:

```python
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:

```bash
cat notes/LeetCode第1号问题：两数之和.md

```

### Embed Animation Assets

The animation GIF for problem #11 can be referenced via direct raw URL:

```markdown
![Container With Most Water](https://github.com/MisterBooo/LeetCodeAnimation/raw/master/0011-maxArea/Animation/maxArea.gif)

```

## 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, and `Animation/` 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`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/model.py), [`create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/create.py), [`base.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/base.py)) to produce the GIF and MP4 files stored in problem folders.
- **Root-level files** including [`contributing.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/contributing.md) and [`template/template.md`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/template/template.md) enforce 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`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/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`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/anima/model.py) for graph data structures and [`anima/create.py`](https://github.com/MisterBooo/LeetCodeAnimation/blob/main/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.