← Figma Interview Insights

Figma·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026Remote

Summary

Figma SWE interview focused on designing a layered drawing editor with full undo/redo support. Pretty deep on data structures and edge case handling, more than I expected for what sounded like a scoped coding question.

Questions Asked (1)

Q1

Design and implement a layered image editor that supports adding, removing, reordering, and editing layers, plus undo and redo functionality. How do you handle edge cases like undo with an empty history or a new operation invalidating the redo stack?

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

I started with the obvious command pattern and two stacks, which was fine, but then they pushed on the snapshot vs reverse-op tradeoff and I kind of fumbled it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core data model (e.g., a list of layers with properties). Then, design the undo/redo system using a command pattern with two stacks, explicitly addressing edge cases like empty history and redo invalidation. Finally, discuss trade-offs and potential optimizations for performance and memory.

Pro tip: Demonstrate awareness of real-world constraints by mentioning how you'd handle memory for large images (e.g., using immutable data structures or persistent data structures) and how undo/redo can be optimized with batching or compression.

1. Clarify Requirements and Scope

Ask questions to understand the expected scale, performance needs, and specific features (e.g., layer types, blending modes). This shows you think before coding.

2. Design the Data Model

Define a Layer class/struct with properties like id, name, image data, opacity, blend mode, and visibility. Use a list to maintain order and a map for quick access by id.

3. Implement Undo/Redo with Command Pattern

Create a Command interface with execute and undo methods. Maintain two stacks: undoStack and redoStack. On a new operation, execute it, push to undoStack, and clear redoStack.

4. Handle Edge Cases

For undo with empty history, check if undoStack is empty and no-op or disable the action. For redo invalidation, clear redoStack whenever a new command is executed.

5. Discuss Trade-offs and Optimizations

Talk about memory vs. speed: storing full snapshots vs. diffs, using persistent data structures, and batching commands for performance.

Key Points to Mention

  • Command pattern for encapsulating operations with undo/redo
  • Two stacks (undo and redo) with clear semantics for edge cases
  • Data structures: list for layer order, map for quick lookup
  • Memory management: storing diffs or using immutable data structures
  • Performance considerations: batching, lazy loading, and efficient reordering
  • Trade-offs between simplicity and scalability (e.g., snapshot vs. command-based undo)

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