← Figma Interview Insights

Figma·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026Remote

Summary

Figma software engineering interview focused on a stateful API design problem, specifically extending a document layer object with undo/redo functionality. The question had real depth to it and required thinking carefully about data structure invariants and edge cases rather than just writing code.

Questions Asked (1)

Q1

You're given an existing document layer API with apply(), batch(), and undo() methods. Design and implement a redo() method, and reason through the expected behavior for edge cases like undo-then-redo, undo-then-new-apply, and multiple consecutive undo/redo calls.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This took me longer to get right than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the existing API's semantics and constraints, then propose a redo stack that mirrors the undo stack, ensuring that new operations clear the redo history. Walk through each edge case with concrete examples, explaining how the stacks evolve and why the behavior is correct.

Pro tip: Mention that redo should be a no-op when the redo stack is empty, and that undo/redo operations should be atomic to avoid inconsistent state. Also, consider whether batch operations should be treated as a single undoable unit.

1. Clarify existing API semantics

Ask questions to understand what apply(), batch(), and undo() do, their return values, and any side effects. Confirm whether undo() can be called multiple times and what it returns when there's nothing to undo.

2. Design redo stack and state management

Propose maintaining a redo stack alongside the undo stack. When undo() is called, push the undone operation onto the redo stack; when redo() is called, pop from redo stack and reapply, pushing back onto undo stack.

3. Define edge case behaviors

Specify that a new apply() or batch() clears the redo stack, redo() on empty stack is a no-op, and multiple undos/redos work by moving operations between stacks. Ensure batch operations are treated atomically.

4. Implement and test

Write pseudocode or actual code for redo(), showing how it interacts with undo() and apply(). Then walk through test cases for each edge case to verify correctness.

5. Discuss trade-offs and extensions

Mention memory considerations for large histories, potential for persistent data structures, and how to handle asynchronous operations or collaboration (e.g., in Figma's multiplayer context).

Key Points to Mention

  • Redo stack mirrors undo stack; operations move between them.
  • New operations (apply/batch) clear the redo stack to maintain linear history.
  • Redo on empty stack should be a safe no-op, possibly returning a boolean or throwing an error based on API design.
  • Batch operations should be undoable/redoable as a single unit.
  • Consider memory limits and history pruning strategies.
  • In collaborative environments, redo may need to be invalidated by remote changes.

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