Overview
Structure and frontmatter conventions for solutions.
This section collects problem walkthroughs grouped by pattern. The conventions below keep solutions consistent and the sidebar tidy.
Content structure
Problems live in pattern folders grouped by the technique they exercise.
content/docs/leetcode/
├── index.mdx # this page
├── meta.json # section config + folder ordering
├── arrays-and-hashing/ # a pattern folder
│ ├── meta.json # folder title + page ordering
│ └── two-sum.mdx # one file per problem
└── two-pointers/ # another pattern folder
└── meta.jsonFile naming
One .mdx file per problem, named with the official LeetCode slug in
kebab-case — the last segment of the problem URL:
https://leetcode.com/problems/two-sum/ -> two-sum.mdxThe problem number belongs in the title (e.g. 1. Two Sum), not the filename.
Frontmatter conventions
Every solution starts with this frontmatter. Only title and description are
required; the rest are optional and used to render the metadata badges at the
top of the page.
---
title: 1. Two Sum
description: Find indices of two numbers that add up to a target.
difficulty: Easy
leetcodeId: 1
url: https://leetcode.com/problems/two-sum/
tags:
- Array
- Hash Table
---| Field | Type | Required | Purpose |
|---|---|---|---|
title | string | Yes | <number>. <Name>, e.g. 1. Two Sum |
description | string | Yes | One-line summary of the problem |
difficulty | Easy | Medium | Hard | No | Renders a colored difficulty badge |
id | integer | No | Problem number, shown as a #1 chip |
url | string | No | Link to the problem; renders a "LeetCode" link |
tags | string[] | No | Pattern / topic chips, e.g. Array |
Non-LeetCode pages simply omit the optional fields — the schema treats them as optional, so nothing breaks.
Ordering
Sidebar order is controlled by pages in each meta.json.
-
Section folders —
leetcode/meta.jsonuses the rest operator so new pattern folders appear automatically after the overview:leetcode/meta.json { "pages": ["index", "..."] } -
Problems within a pattern — list them explicitly to control order:
arrays-and-hashing/meta.json { "title": "Arrays & Hashing", "pages": ["two-sum"] }
Multiple approaches
Keep every approach for a problem in one file. The metadata (difficulty,
id, url, tags) describes the problem, so it shouldn't be duplicated across
files. Use one ## Approach N: … section per approach, each with its own
intuition, code block, and complexity, then close with a comparison table.
## Approach 1: Brute Force
## Approach 2: One-Pass Hash Map
## Takeaway (comparison table + which is optimal)Last updated on