二分的边界
会写,但老是错边界 —— 因为你没说清自己维护的是哪个不变量。
Copy the prompt, then pick a model. It plays the interviewer and asks you through it scene by scene instead of handing you the answer.
On a phone with the app installed, the system opens the app directly. Links cannot open external apps inside WeChat — open it in a browser first.
The copied text ends with the answer key the model grades you against. Don't read it yourself first — working it out on your own is the point.
二分的三种写法互相不兼容,混着用不是漏解就是死循环。而它们的差别不用背 —— 全部由一句话推出来:答案始终在当前区间里。这一份就逼你说出那句话,然后让循环条件、mid 取法、收缩方式自己长出来。
第四幕是照妖镜:写得出「第一个 >= target」的人很多,写得出「最后一个 <= target」的人少一半。
What this one drills
This prompt in the repo (the answer key is at the end of that file — you'll see it)
Have you done this one?
Sign in to mark this one as practised — next time you come back you'll see when you did it.
Notes from people who did this one
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
- Pick one, open it, copy the prompt.
- Paste it into a brand-new conversation, say nothing, and wait for its first question.
- 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.
Sign in to write a note.