1 min lesson
Mock coding screen (no AI)
Work through the cases in "Mock coding screen (no AI)", pairing each signal with the move that fits.
Step 1 of 3
Cursor's first technical screens disallow AI beyond autocomplete. The point isn't nostalgia for whiteboards. They want to see the engineer underneath the tooling - whether you can actually reason about an editor primitive when the model can't reason for you.
Pick one editor-flavored problem, set a 45-minute clock and turn off everything but tab-complete. Narrate the whole way as if an interviewer is on the call. Then redo a variant with AI on, vetting every suggestion out loud, so you've rehearsed both modes the loop will put you in.
Learn more
Full explanation
Apply non-overlapping edits to one buffer
interface Edit { start: number; // inclusive char offset end: number; // exclusive char offset text: string; // replacement } function applyEdits(source: string, edits: Edit[]): string { // Reject overlaps up front; they make the result ambiguous. const sorted = [...edits].sort((a, b) => a.start - b.start); for (let i = 1; i < sorted.length; i++) { if (sorted[i].start < sorted[i - 1].end) { throw new Error("overlapping edits are not applicable"); } } // Apply from the end so each splice can't shift an earlier edit's offsets. let out = source; for (let i = sorted.length - 1; i >= 0; i--) { const e = sorted[i]; out = out.slice(0, e.start) + e.text + out.slice(e.end); } return out; }
The reason to type it by hand is that the screen will ask the questions only the author can answer: why sort descending, why reject overlaps instead of merging them, what the complexity is and where it could be tightened on a million-line buffer.
Learn more
Optional practice
Practice: Mock coding screen (no AI)
QWhen applying a list of edits (start, end, replacement) to a buffer, why apply them in descending position order?