FastPrepDocument and Layer Operations
Problems/Document and Layer Operations

Document and Layer Operations

Figma logoFigma● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Figma software-engineering intern report says candidates wrote functions to manipulate documents and layers after reviewing a design document. It did not share the set of operations, the state model, the output, the interface, examples, or the limits. Our version is about 45% the same as the reported question.

Process operations on a collection of documents and layers. Document IDs and layer IDs are lowercase ASCII strings, and layer IDs are globally unique.

Each operation has one of these forms:

  • ["createDocument", documentId] creates an empty document.
  • ["addLayer", documentId, layerId, value] creates a layer in the document.
  • ["renameLayer", layerId, newValue] changes a layer's value.
  • ["moveLayer", layerId, targetDocumentId] moves a layer to another document without changing its ID or value.
  • ["removeLayer", layerId] removes a layer.

After all operations, return every document ordered by document ID. Serialize a document as documentId{layerId=value,...}, with its remaining layers ordered by layer ID. Include empty documents as documentId{}.

Function

processDocumentLayers(operations: String[][]) → String[]

Examples

Example 1

operations = [["createDocument","draft"],["addLayer","draft","title","hello"],["renameLayer","title","welcome"]]return = ["draft{title=welcome}"]

The layer title remains in draft with its updated value.

Example 2

operations = [["createDocument","a"],["createDocument","b"],["addLayer","a","z","green"],["addLayer","a","m","blue"],["moveLayer","z","b"]]return = ["a{m=blue}","b{z=green}"]

Moving z removes it from document a and preserves it in document b.

Example 3

operations = [["createDocument","doc"],["addLayer","doc","x","one"],["removeLayer","x"]]return = ["doc{}"]

The document remains after its only layer is removed.

Constraints

  • 1 <= operations.length <= 200000.
  • At most 100000 documents and 200000 layers are created.
  • Every document ID and layer ID is unique when created.
  • Every non-create operation references an existing document or layer as required.
  • IDs and values are non-empty lowercase ASCII strings of at most 40 characters and do not contain {, }, =, or ,.

More Figma interview questions

  • Layer History with Batch Undo and RedoOA · PHONE SCREEN · Seen Sep 2026
  • Find the First Matching Ordered EntryOA · Seen Sep 2022
  • Recursive Display SortPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Route Graph Reachability with a Broken LinkPHONE SCREEN · Seen Oct 2026
  • Rich Text Parser Part 3 (Depth Tokens)PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Rich Text Parser Part 2 (Parse Nested Groups)PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Rich Text Parser Part 1 (Validate Tokens)PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Table Selection and Color UpdatesPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Sort Documents Left to RightONSITE INTERVIEW · Seen Aug 2026
  • Symmetric Binary TreeONSITE INTERVIEW · Seen Feb 2026

Similar questions at other companies

  • Temporal Key-Field Database with Prefix ScansThe Trade Desk · OA
  • In-Memory File SystemAirbnb · OAAirbnb interview questions
  • Power Cell BankOptiver · OAOptiver interview questions
  • Four-Level Banking System with Scheduled PaymentsZipRecruiter · OAZipRecruiter interview questions
  • Task Management SystemCoinbase · OACoinbase interview questions
  • Task Management SystemAnthropic · OAAnthropic interview questions
  • Progressive Parcel Tracking OperationsKlaviyo · OAKlaviyo interview questions
  • Recipe Management SystemRamp · OARamp interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions

Interview reports that mention this question

  • Figma SWE Intern OA and Final Round: 21 Experiences

Figma interview experiences

  • Figma interviews · November 2026
  • Figma SWE Intern OA Questions: 25 Experiences
All Figma interview questionsSee Figma hiring insights
Saved
class Solution {
    public String[] processDocumentLayers(String[][] operations) {
        // Write your code here.
    }
}
Checking account…