← Figma Interview Insights

Figma·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Apr 2026

Summary

Figma ML engineer interview with a coding problem centered on document editor state management. The problem was more design-heavy than I expected for an ML role, which threw me off a bit.

Questions Asked (1)

Q1

You're building a layer editor (think Figma-like) that supports operations like add, delete, move, and property changes, plus an Undo command and a batch primitive that groups operations into a single atomic unit. Implement Redo: after one or more Undos, the user can re-apply the most recently undone operation or batch. A new mutating operation after an Undo should clear the redo stack. Batched operations must behave atomically, same as with Undo.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

Took me a second to even process the scope of this.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core data structures: an undo stack and a redo stack, where each entry is either a single operation or a batch (composite) operation. Explain how Redo works by popping from the redo stack and re-applying the operation, and how a new mutating operation clears the redo stack. Emphasize atomicity for batches by treating them as a single unit in both stacks.

Pro tip: Mention that the redo stack should store the inverse of the original operation (or the operation itself if it's idempotent) to ensure correct re-application, and highlight that batch operations must be undone/redone atomically to maintain consistency—this shows you understand real-world editor state management.

1. Clarify requirements and constraints

Ask about the expected frequency of operations, memory constraints, and whether operations are invertible. Confirm that batches are atomic and that redo stack clears on new mutations.

2. Design core data structures

Propose two stacks: undoStack and redoStack. Each element is an operation object with apply() and revert() methods, or a batch containing a list of operations. For batches, ensure they are treated as a single entry.

3. Define operation semantics

Specify that each operation must be able to apply and revert itself. For redo, the operation is re-applied (or its inverse is reverted). Batches apply/revert all contained operations in order (or reverse order for revert).

4. Implement Undo and Redo logic

Undo: pop from undoStack, revert operation, push to redoStack. Redo: pop from redoStack, apply operation, push to undoStack. For batches, treat as single unit. New mutating operation: clear redoStack, push to undoStack.

5. Discuss trade-offs and edge cases

Address memory usage (e.g., limiting stack size), performance of batch operations, and handling of non-invertible operations. Mention potential optimizations like command pattern or memento.

Key Points to Mention

  • Use of two stacks (undo and redo) to manage history.
  • Batches as composite operations that are atomic in both undo and redo.
  • Clearing the redo stack upon a new mutating operation.
  • Operation invertibility and how redo re-applies operations.
  • Memory management and potential stack size limits.
  • Trade-offs between storing operations vs. state snapshots (command pattern vs. memento).

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