All practice tasks

Coding (Platform)

Optimistic reorder journal

dom · Hard · optimistic reconciliation

A board supports several rapid card moves. When one request fails, the current implementation restores the entire old board and erases later confirmed moves.

Task

Reconcile move intents independently so failure restores only the affected intent while later confirmed order remains.

Contract

Input is {initialIds,events}. move has intentId,id,toIndex; success and failure have intentId. Return {ids,pending,failed}. Indices are clamped.

Acceptance criteria

  • Apply each move immediately.
  • Track the prior neighbor anchors for each intent.
  • Success removes only that intent.
  • Failure removes that move effect without discarding later intents.

Constraints

  • Do not mutate caller-owned input.
  • Keep the supplied framework adapter and public contract unchanged.
  • Add candidate tests for at least one boundary not covered by the public cases.

Editable files

  • src/repair.js — Task-specific state or service boundary
  • tests/candidate.test.js — Candidate-authored regression

What this task practices

Optimistic reorder journal is a coding (platform) interview exercise that trains prompt interpretation, explicit assumptions, a concrete response, and a clear explanation of tradeoffs. The catalog marks it as hard difficulty. It focuses on State Modeling, Regression Testing, Technical Reasoning. The signed-in workspace provides the tools for the round and evaluates the attempt against task-specific criteria. Reference solutions, hidden checks, evaluator instructions, and candidate work remain private.

Sign in to startThe workspace and evaluation open after sign in.