AiLearn AI Coding
hardOpen-ended · your tools60 min Premium

Collaborative Editor

Concurrent text edits merged without corruption, last-write-wins and OT-lite conflict resolution from scratch.

Data Structures

Problem

A greenfield build: the core of a collaborative text editor. Clone the starter repo, use your own editor and AI tools, and build under a 60-minute timer.

The spec

A document is a string. Two clients make concurrent edits — insertions and deletions at positions — that must merge without corrupting the document or silently losing text.

  • apply(doc, op) — apply a single operation (insert at index, delete range).
  • merge(baseDoc, editsA, editsB) — merge two concurrent edit lists. Last-write-wins on overlapping ranges is acceptable; document a simple transform that keeps both edits when they don't overlap.
  • Each edit carries a base revision, so a client can replay from a known point.

The conflict model you choose (LWW vs. a transform) is your design call — being able to explain it is the point.

What interviewers watch

  • Do you model edits as operations, not snapshots? That's the whole problem.
  • Is the merge strategy honest — does it handle overlapping inserts, not just disjoint ones?
  • Position stability: when two edits both shift indices, does your model break?
  • Are the tricky cases tested before you prompt the AI for the fix?

Submission

Export your code and AI chat transcript, note tools and time, and submit for a verdict.

Deliverables

  • An apply(edit) engine for insert/delete operations on a document
  • A merge strategy for concurrent edits (LWW or a simple transform)
  • Revision tracking so a client can replay from a known base
  • Tests for concurrent insert/delete conflicts