Kacam.net

Observe the world

Algorithms: one technique at a time

Not "sorting" or "dynamic programming", but "the boundary in binary search", "defining the DP state", "is this duplicate on the same level or the same branch" — one prompt drills one thing, until you can say why.

These prompts only exist in 简体中文 for now.

How to use this

This set teaches rather than interrogates: it guides you instead of pressing until you have nothing left to say. When you're stuck it first asks which layer you're stuck at (never heard of it / know it but not why / know why but can't write it), then decides what to give. Only after guiding you twice on the same point will it spell the answer out — and then it asks you to say it back in your own words.

How to start

  1. Pick one, open it, copy the prompt.
  2. Paste it into a brand-new conversation, say nothing, and wait for its first question.
  3. Trace by hand before you write code — it will interrupt you. Walking through an array of length 2 beats writing the template ten times.

Four commands you can call out at any time

  • 跳过 move to the next scene now
  • 换个说法 explain this bit again from another angle
  • 直说吧 spell the answer out, then make me say it back
  • 复盘 jump to the wrap-up and print the review card

Three traps

  • Don't read the answer key at the end first — that "how people get it wrong" section is the answer to every question it will ask you.
  • Don't rush to code. With algorithms, writing code is the easiest way to hide the fact that you haven't actually thought it through.
  • When it starts praising you, point it back to the "don't praise me" rule. Guiding is not coddling.

Can't come up with a solution? Start with defining the DP state. Always off by one? Binary search and prefix sums. Can't recognise the shape of a problem? Monotonic stack and sliding window. The complexity one underpins several others — do it early.

Fundamentals

同样是 O(n log n),为什么快排更快
快排和堆排都是 O(n log n),实测差两三倍。差在哪?
★★★★☆ · about 40 min

Data structures

求第 k 大,为什么用小顶堆
求最大的 100 个,用小顶堆 —— 方向是反的,为什么?
★★★☆☆ · about 30 min
These prompts are open source They live in the public kacam-net/hero-prompts repo. If one of them doesn't press hard enough, or its answer key is missing a line, go and change it — whether it ships here is a separate call, made by the catalogue on this side.