CORE.DUMP

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.json

File 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.mdx

The 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.

two-sum.mdx
---
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
---
FieldTypeRequiredPurpose
titlestringYes<number>. <Name>, e.g. 1. Two Sum
descriptionstringYesOne-line summary of the problem
difficultyEasy | Medium | HardNoRenders a colored difficulty badge
idintegerNoProblem number, shown as a #1 chip
urlstringNoLink to the problem; renders a "LeetCode" link
tagsstring[]NoPattern / 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 foldersleetcode/meta.json uses 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