← Figma Interview Insights

Figma·Machine Learning Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

Figma ML engineer round that ended up being more systems-thinking than I expected. The whole session revolved around one design problem, but it went deep fast.

Questions Asked (1)

Q1

You have a document model (think layers in a design tool) that supports add, delete, move, and property-change operations. Build an undo system that correctly reverts the most recent operation. Walk through how you'd record operations and compare that approach against just snapshotting the whole document.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

I started with snapshots because it felt safe, and the interviewer just kind of waited.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by proposing a command pattern where each operation is encapsulated as an object with do and undo methods, stored in a stack for LIFO undo. Then compare this to snapshotting, highlighting trade-offs in memory, performance, and complexity, and suggest a hybrid approach for robustness.

Pro tip: Mention that in a collaborative environment like Figma, undo must be scoped to the user's own operations, and consider using inverse operations for efficiency while periodically snapshotting to handle edge cases.

1. Define the Command Interface

Create an abstract Command class with execute and undo methods. Each operation (add, delete, move, property-change) becomes a concrete command that captures all necessary state to perform and reverse itself.

2. Implement Undo Stack

Maintain a stack of executed commands. When an operation occurs, push its command onto the stack. Undo pops the most recent command and calls its undo method.

3. Handle State Capture

For each command, store the minimal state needed to undo: e.g., for delete, store the deleted object and its position; for move, store old and new positions; for property-change, store old and new values.

4. Compare with Snapshotting

Discuss snapshotting: storing full document copies. Highlight pros (simplicity, reliability) and cons (memory, performance). Contrast with command pattern's efficiency but higher implementation complexity.

5. Propose Hybrid or Optimizations

Suggest combining approaches: use commands for fine-grained undo, but periodically snapshot to handle complex operations or memory constraints. Mention compression, delta encoding, or persistent data structures.

Key Points to Mention

  • Command pattern with do/undo methods and a stack for LIFO undo.
  • Memory and performance trade-offs: commands use less memory but may be complex; snapshots are simple but heavy.
  • Handling of composite operations: group multiple commands into a single undoable transaction.
  • Collaborative editing considerations: undo should only affect the user's own operations, requiring operation transformation or scoping.
  • Edge cases: undoing after external changes, redo stack, and memory management (e.g., limiting stack size).
  • Alternative data structures: persistent data structures (e.g., immutable trees) for efficient snapshots.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.