← Figma Interview Insights

Figma·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Apr 2026Remote

Summary

Figma software engineering interview focused on a stateful API design problem. The core challenge was extending an existing document layer with undo/redo semantics, which sounds manageable until you start thinking through all the edge cases around batch invalidation.

Questions Asked (1)

Q1

You're given an existing Document Layer API with apply(), batch(), and undo(). Design and implement a redo() method, and reason through the full interaction between all four operations including edge cases like consecutive undos, redo after new mutations, and state invariants.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This one took me a while to get off the ground.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the existing API semantics and state model, then propose a redo stack that mirrors the undo stack, ensuring redo is only valid after an undo and is cleared on new mutations. Walk through the full interaction of apply, batch, undo, and redo with concrete examples, highlighting edge cases and invariants.

Pro tip: Explicitly state the invariant that the redo stack is cleared whenever a new mutation occurs, and discuss how batch operations should be treated as a single undoable/redoable unit to avoid partial state issues.

1. Clarify API semantics and state model

Ask questions to confirm what apply(), batch(), and undo() do, whether they are synchronous, and how state is represented (e.g., immutable snapshots vs. command objects).

2. Design redo() with dual stacks

Propose maintaining an undo stack and a redo stack; undo() pops from undo stack and pushes onto redo stack, while redo() does the reverse, with redo() being a no-op if the redo stack is empty.

3. Define interaction rules and invariants

Specify that any new mutation (apply or batch) clears the redo stack, and that batch operations are atomic units on both stacks; also ensure undo/redo are idempotent when stacks are empty.

4. Walk through edge cases

Illustrate consecutive undos, redo after new mutations, redo after multiple undos, and interleaving of batch and single operations, showing how the stacks evolve.

5. Discuss implementation and trade-offs

Compare command pattern vs. snapshot approach for memory and performance, and mention potential optimizations like coalescing or limiting stack size.

Key Points to Mention

  • Redo stack is cleared on any new mutation to prevent inconsistent state.
  • Batch operations should be treated as a single atomic unit for undo/redo.
  • Undo and redo are inverses; redo is only valid after an undo.
  • State invariants: undo stack + redo stack represent a linear history; no branching.
  • Edge cases: consecutive undos, redo after new mutations, empty stack behavior.
  • Trade-offs between command pattern (memory efficient) and snapshot (simpler but heavier).

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