Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/other.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Something else
description: A bug in the site as a whole, a problem you'd like a page for, or an idea.
description: A bug in the site as a whole, a problem you'd like a page for, something in the AI Engineer course, or an idea.
body:
- type: textarea
id: what
Expand Down
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [ ] every badge says what was actually run; every trap output was produced by running it
- [ ] `npm run build` succeeds, then `npm run audit -- <slug>` passes
- [ ] opens on step 1, and reads well beside another page at the same width
- [ ] **If this changes the AI Engineer course** (`course/`, `src/lib/ai/`, `src/pages/ai-engineer/`): `npm run build` and `npm run audit` pass, and new links open
- [ ] **If this changes how every page is built** (`src/lib/`, `src/layouts/`, `lesson.css`, `kit.css`, `scripts/check-lessons.mjs`): I updated `.claude/skills/leetcode-solution-page/` (usually `references/lesson-kit.md`) and `CONTRIBUTING.md` to match, or this change doesn't affect how a page is made.

See [CONTRIBUTING.md](../CONTRIBUTING.md) for what each item means.
67 changes: 53 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Contributing a solution page
# Contributing

This repo is the site at [learn.devmtnaing.com](https://learn.devmtnaing.com),
with two sections. Most of this guide is about the first:

- **LeetCode solution pages** (`src/lessons/`): the rest of this guide.
- **The AI Engineer course** (`course/` and `src/pages/ai-engineer/`): see
[Changing the AI Engineer course](#changing-the-ai-engineer-course) at the end.

## Contributing a solution page

The most useful contribution is a new solution page for a problem on the list
that doesn't have one yet: any row on the problem list (`/leetcode`) marked *Solution coming
Expand All @@ -9,7 +18,7 @@ Before you start, open a page or two to see what one looks like:
copy. Every page has the same parts in the same order — the layout comes from
the shared kit, so you write content, not markup.

## What a page promises
### What a page promises

A reader comes back to these pages to relearn a problem, watch it run, and copy
code they can trust. So three rules are firm:
Expand All @@ -25,14 +34,14 @@ code they can trust. So three rules are firm:
carries between steps, in the shape the code holds it: the map, the stack,
the call stack. It isn't a cartoon of the idea.

## You will need
### You will need

- Node 20+, Python 3.10+, Ruby 3
- Docker, for Go and Rust. The verifier runs them in `golang:1.23-alpine` and
`rust:1.98-slim`, and reports them as *skipped*, not passed, when Docker isn't
running.

## Building a page, step by step
### Building a page, step by step

A page is one folder, `src/lessons/<leetcode-slug>/`. The route finds it and
the problem list links it automatically, so there is nothing else to register.
Expand All @@ -46,7 +55,7 @@ verify/<slug>/spec.py the corpus, the oracle, the five drivers
verify/<slug>/adapter.mjs how the walkthrough reads a corpus line
```

### 1. Get the problem exactly right
#### 1. Get the problem exactly right

Quote the statement, don't paraphrase it: readers will submit against the real
one. LeetCode's GraphQL endpoint returns it without a key:
Expand All @@ -59,13 +68,13 @@ curl -s -X POST https://leetcode.com/graphql/ -H 'Content-Type: application/json
`statement.html` holds the prose paragraphs only. Examples and constraints
have their own components in `lesson.js` and `page.js`.

### 2. Write the brute force first
#### 2. Write the brute force first

It is the reference everything else is checked against, so write it first and
confirm it on the examples. Then write the better approach. Most pages show two
(the brute force and the one worth learning); some show three.

### 3. Write the listings as files, then generate the code table
#### 3. Write the listings as files, then generate the code table

Write each approach in each language as a plain file (`brute.rb`,
`brute.py`, `brute.js`, `brute.go`, `brute.rs`, `hash.rb`, …) and mark each
Expand All @@ -85,7 +94,7 @@ and paste the `CODE` block into `lesson.js`. Don't retype listings: the
verifier runs the text in `lesson.js`, and the generator strips the markers so
that text is exactly the file you wrote.

### 4. Write `lesson.js`
#### 4. Write `lesson.js`

Copy `src/lessons/two-sum/lesson.js` and replace its parts. It ends with one
`mountLesson({...})` call. Keep that call last in the file, because it runs the
Expand Down Expand Up @@ -131,7 +140,7 @@ and calls get `cells(items, { wide: true })` and a board or matrix
Give a failed comparison its own frame. The branch that *doesn't* fire is often
the one worth seeing.

### 5. Write `page.js`
#### 5. Write `page.js`

Every prop is required, and `npm run check` names any that are missing:
`title`, `summary`, `eyebrow`, `lede`, `links`, `constraints`, `part1Sub`,
Expand All @@ -145,7 +154,7 @@ Traps are the places the statement trips people up: each one names what the
wrong code returns, and you ran it to find out. Notes are questions a reader would ask
("Why check for the partner *before* storing?"), answered in a paragraph.

### 6. Verify
#### 6. Verify

Write `verify/<slug>/spec.py`: `DRIVERS` (a program per language that reads
one case per line and prints one answer per line, with `{SOL}` where the
Expand Down Expand Up @@ -174,7 +183,7 @@ Things that have bitten before:
- Rust's `i32` overflows silently in release builds.
- Go's `for range` over a map is randomly ordered.

### 7. Check the page
#### 7. Check the page

```sh
npm run check # structure: every key highlighted, every part present
Expand All @@ -192,7 +201,7 @@ finds and opens a page. What it cannot
tell you is whether the page reads well — open it
beside another one and look.

## Burmese
### Burmese

Pages are bilingual, but **you don't need to write Burmese**. Any string can
be plain English, or `t(english, burmese)` from `kit.js`. A missing Burmese side
Expand All @@ -203,7 +212,7 @@ If you do translate: keep code, identifiers, problem titles and terms of art
translate idioms word for word. [docs/translation-review.md](docs/translation-review.md)
collects phrasings a native reader should check. Help there is very welcome.

## Pull request checklist
### Pull request checklist

- [ ] `npm run check` passes
- [ ] `npm run verify -- <slug>` passes, with Go and Rust run (not skipped)
Expand All @@ -225,9 +234,39 @@ shared page code but neither the skill nor this guide, so a reviewer can ask
whether the docs need to follow. A third job runs `npm run audit` over every
page. Reading the page beside another one is still yours to do.

## Using Claude Code
### Using Claude Code

The repo ships a project skill, `.claude/skills/leetcode-solution-page/`. In
Claude Code, `/leetcode-solution-page <problem>` follows this guide end to end,
verification included. It holds a contribution to the same standard as a
hand-written one: the checklist above still applies.

## Changing the AI Engineer course

The course is plain markdown in [`course/`](course/README.md), and the pages
under `/ai-engineer` are built from it at build time
(`src/lib/ai/course.ts`), so a change to the markdown is a change to the site.

- **Module text** lives in each track's README. A module is a heading
(`## 1.4 …` in Track 1, `### 2.7 …` in Tracks 2 and 3, `## Level 2: …` in
Math) with `**Why:**`, `**Concepts:**`, `**Learn**` (`- *Core:*` and
`- *Optional:*` items), `**Build**` (`- [ ]` items) and `**Checkpoint:**`.
Keep that shape: the parser turns each part into a step of the module.
- **Time estimates** come from the weeks column of each track's module table.
They are weeks at ~13.5 hours a week; the site scales them to the reader's
chosen pace.
- **Quizzes and flashcards** are in `src/lib/ai/quizzes.ts` and
`src/lib/ai/flashcards.ts`, keyed by module id (`t1-1.4`). A question names
its correct option and says why.
- **Papers and projects** are `course/track-3-research-engineer/papers.md` and
`course/projects/README.md`.
- **A new section** (another course next to LeetCode and AI Engineer) is one
entry in `src/data/sections.ts`, which gives it a rail icon and its own menu,
plus its pages.

Checklist for a course change:

- [ ] `npm run build` succeeds, and the module still shows all of its steps on its track page
- [ ] `npm run audit` passes: it checks the hub and a sample of AI Engineer
pages for errors, overflow at 320 and 400px, and contrast in both themes
- [ ] links you added open (resources are linked out, so check them)
122 changes: 72 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# LeetCode solution pages
# learn

**Live: [learn.devmtnaing.com](https://learn.devmtnaing.com).** Two sections share one site, one design and one progress record:
**Live: [learn.devmtnaing.com](https://learn.devmtnaing.com).** A learning site with two sections that share one design and one progress record:

- **[LeetCode](https://learn.devmtnaing.com/leetcode)**: open any problem and step through its solution.
- **[AI Engineer](https://learn.devmtnaing.com/ai-engineer)**: a self-study path from backend engineer to AI research engineer, built from the markdown course in [`course/`](course/README.md), with quizzes, flashcards, XP and streaks.
- **[LeetCode](https://learn.devmtnaing.com/leetcode)**: interview problems you can step through one state change at a time, with tested code in five languages.
- **[AI Engineer](https://learn.devmtnaing.com/ai-engineer)**: a self-study path from backend engineer to AI research engineer, in three tracks, with quizzes, flashcards and portfolio projects.

[![Lowest Common Ancestor, step 4 of 7: the tree with the call stack beside it and the Ruby line that is running highlighted](docs/screenshots/walkthrough.png)](https://learn.devmtnaing.com/leetcode/lowest-common-ancestor-of-a-binary-tree)
[![The hub: jump back into the last LeetCode problem and the next AI Engineer step, a card for each section, and the week's XP by section](docs/screenshots/home.png)](https://learn.devmtnaing.com)

Interactive solutions to interview problems. Each page quotes the problem,
steps through the algorithm one state change at a time, and ends with complete
solutions in Ruby, Python, JavaScript, Go and Rust. Every one of those
solutions was run against thousands of cases before it was published.
A section rail on the left switches between the sections; each section has its own menu. Progress, XP and streaks are kept per section and add up on the hub. ⌘K searches the section you are in. Light and dark themes; the LeetCode pages are also in မြန်မာ (Burmese). All screenshots here are in the dark theme.

Every page follows the same three parts:
## LeetCode

Each page quotes the problem, steps through the algorithm one state change at a
time, and ends with complete solutions in Ruby, Python, JavaScript, Go and
Rust. Every one of those solutions was run against thousands of cases before it
was published. Every page has the same three parts:

1. **The question.** LeetCode's statement, quoted word for word, the worked
examples, a small widget for the idea the statement hinges on, and the
Expand All @@ -24,71 +26,91 @@ Every page follows the same three parts:
3. **The whole solution.** Paste-ready code for every approach and language,
each with a badge saying exactly how it was checked.

The pages are bilingual, English and မြန်မာ (Burmese), in a light and a dark
theme. The screenshots below are all in the dark one.
[![Lowest Common Ancestor, step 4 of 11: the tree with parents recorded, the stack, and the Ruby line that is running highlighted](docs/screenshots/walkthrough.png)](https://learn.devmtnaing.com/leetcode/lowest-common-ancestor-of-a-binary-tree?step=4)

The list has 45 interview problems, 15 each of easy, medium and hard, chosen
where three of LeetCode's own study plans agree ([how](docs/problem-list.md)),
plus 2 from outside that list, grouped by pattern. Every one has a solution
page. "Mark as solved" on a page ticks it on the list and earns LeetCode XP.

## Screenshots
[![The problem list: patterns in the section menu, a difficulty filter, solved problems ticked](docs/screenshots/problems.png)](https://learn.devmtnaing.com/leetcode)

**The question.** The statement next to a widget for the one idea it turns on.

[![The top of the Two Sum page: the statement on the left, a target slider on the right](docs/screenshots/question.png)](https://learn.devmtnaing.com/leetcode/two-sum)

**The problem list.** 47 problems grouped by pattern, with search, a difficulty filter and ⌘K from any page.
**In Burmese.** Trapping Rain Water with two pointers, finished.

[![The home page: patterns down the side, problems with difficulty and acceptance rate](docs/screenshots/home.png)](https://learn.devmtnaing.com/leetcode)
[![Trapping Rain Water with Burmese narration, the answer of 6 units filled in](docs/screenshots/burmese.png)](https://learn.devmtnaing.com/leetcode/trapping-rain-water?approach=pointers)

**In Burmese.** Trapping Rain Water with two pointers, finished.
## AI Engineer

A curriculum for a backend engineer moving into AI, in the order the jobs come:

| Track | Goal | At the course's own pace (~13.5 h a week) |
|---|---|---|
| **1 · AI Application Engineer** | Use models well: APIs, RAG, agents, MCP, evals, agent frameworks, durable workflows | ~3.5–4 months |
| **2 · ML / AI Systems Engineer** | Neural nets from scratch, transformers, fine-tuning, GPUs, inference, distributed training, Kubernetes | ~7–9 months |
| **3 · AI Research Engineer** | Learning theory, scaling, RL and post-training, interpretability, reproducing papers | ~8–12 months, then ongoing |
| **Math** | Three levels, each paired with a track | alongside |

Every module has five steps: **concepts**, the **resources** to work through,
hands-on **builds**, a **quiz** (with hearts and retries), and a **checkpoint**
that earns a crown. You choose a study pace in hours a week, and every time
estimate scales to it. Flashcards come back on a spaced schedule; the reading
list has 57 papers in order; the projects are portfolio capstones with full
specs.

[![The Track 1 path: modules on a timeline, each with its five steps, the first one crowned](docs/screenshots/ai-path.png)](https://learn.devmtnaing.com/ai-engineer/track-1)

[![A quiz question on retrieval, answered correctly, with the explanation](docs/screenshots/ai-quiz.png)](https://learn.devmtnaing.com/ai-engineer/track-1/1-4/quiz)

[![Trapping Rain Water with Burmese chrome and narration, the answer of 6 units filled in](docs/screenshots/burmese.png)](https://learn.devmtnaing.com/leetcode/trapping-rain-water?approach=pointers)
The course itself is markdown in [`course/`](course/README.md), readable on its
own. The pages are built from it, so editing a track's README updates the site.

## Run it

```sh
npm install
npm run dev # http://localhost:4321
npm run build # static site in dist/
npm run check # structural check of every lesson
npm run audit # every built page in a real browser (after npm run build)
npm run check # structural check of every LeetCode lesson
npm run audit # every lesson, the hub and the AI pages in a real browser (after build)
npm run verify -- <slug> # rerun a lesson's listings in five languages
npm run screenshots # retake docs/screenshots (after build)
npm run refresh-problems # re-read titles, tags and acceptance rates from LeetCode
```

The problem list has 45 interview problems, 15 each of easy, medium and hard,
chosen where three of LeetCode's own study plans agree
([how](docs/problem-list.md)), plus 2 from outside that list, grouped by
pattern (Arrays & Hashing, Two Pointers, Trees, …). Every one of them has a
solution page. To add a problem or fix a page, see
[CONTRIBUTING.md](CONTRIBUTING.md).
To add a LeetCode page or change the course, see [CONTRIBUTING.md](CONTRIBUTING.md).

## What is in the repo

```
src/pages/index.astro the hub: both sections
src/pages/leetcode/index.astro the problem list
src/pages/leetcode/[slug].astro renders every lesson folder
src/lessons/<slug>/ one folder per solution page
src/pages/ai-engineer/ the AI Engineer path, module guides and lesson steps
src/pages/profile.astro progress across both sections
course/ the AI Engineer course as markdown (the pages read it at build)
src/lib/ai/ course parser, quizzes, flashcards, progress painter
src/components/ai/ Preact islands: lesson steps, practice, profile, rail
src/lib/progress.ts progress, XP and streak for the whole site (localStorage)
src/lib/ the shared kit: stepper, stage shapes, trees, i18n
src/styles/ tokens (one design, a teal and an indigo accent), app shell, lessons, AI section
scripts/check-lessons.mjs structure and format check
scripts/audit.mjs drives every built page in Chromium
scripts/refresh-problems.mjs refreshes src/data/problems.json from LeetCode
scripts/verify/ runs every listing in five languages
verify/<slug>/ each lesson's test corpus and drivers
docs/ how the problem list was chosen; translation notes; screenshots
wrangler.jsonc Cloudflare: serve dist/ at learn.devmtnaing.com
src/pages/index.astro the hub
src/pages/profile.astro progress, the study plan, export and import
src/pages/leetcode/ the problem list and [slug].astro, which renders every lesson
src/lessons/<slug>/ one folder per LeetCode solution page
src/pages/ai-engineer/ AI Engineer overview, tracks, module guides, lesson steps, practice
course/ the AI Engineer course as markdown (the pages read it at build)
src/lib/ai/ course parser, quizzes, flashcards, the progress painter
src/components/ai/ Preact islands: lesson steps, practice, profile, progress rail
src/components/ the shell: section rail, section menu, search, theme
src/data/sections.ts the sections and each one's menu
src/lib/progress.ts progress for the whole site: XP per section, streaks, pace
src/lib/ the LeetCode kit: stepper, stage shapes, trees, i18n
src/styles/ tokens (one design, a teal and an indigo accent), shell, lessons, AI
scripts/ lesson check, browser audit, verify, screenshots, problem refresh
verify/<slug>/ each lesson's test corpus and drivers
docs/ how the problem list was chosen, translation notes, screenshots
wrangler.jsonc Cloudflare: serve dist/ at learn.devmtnaing.com
```

The site is fully static: every page is prerendered and served as a file (the
AI Engineer's interactive steps are small Preact islands on those pages), so
there's no backend. A solution page is a folder of data and one step generator
per approach. The kit supplies the transport, code panel, language switching
and layout. Every lesson has a spec in `verify/`, so `npm run verify --
<slug>` reruns exactly what its badges claim.
The site is fully static: every page is prerendered and served as a file, and
the interactive parts of the AI Engineer section are small Preact islands on
those pages. Progress lives in the browser (`localStorage`); export it from the
profile to move it. A LeetCode page is a folder of data and one step generator
per approach, and the kit supplies the rest. Every lesson has a spec in
`verify/`, so `npm run verify -- <slug>` reruns exactly what its badges claim.

## License

Expand Down
Binary file added docs/screenshots/ai-path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ai-quiz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/burmese.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/problems.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/question.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/walkthrough.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading