FastPrepSort Documents Left to Right
Problems/Sort Documents Left to Right

Sort Documents Left to Right

Figma logoFigma● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names left-to-right document sorting. It does not give how coordinates are passed in or how ties work. Our version is about 90% the same as the reported question.

Each document is represented by [documentId, leftX], where leftX is its integer left-edge coordinate on a canvas.

Return the document identifiers ordered from left to right by increasing leftX. When two documents have the same coordinate, preserve their original input order.

Function

sortDocumentsLeftToRight(documents: String[][]) → String[]

Examples

Example 1

documents = [["header","40"],["sidebar","10"],["card-a","25"],["card-b","25"]]return = ["sidebar","card-a","card-b","header"]

The two cards share a coordinate, so their input order is preserved.

Constraints

  • 1 <= documents.length <= 200000
  • Every row contains exactly two strings.
  • Document identifiers are unique nonempty ASCII strings of at most 40 characters.
  • -10^9 <= leftX <= 10^9.

More Figma Onsite Interview questions

  • Recursive Display SortPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 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
  • Symmetric Binary TreeONSITE INTERVIEW · Seen Feb 2026
  • Topmost Accessible NodesPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2025
  • Nested Template Variable ExpansionONSITE INTERVIEW · Seen Jun 2024
  • Parse, Validate, and Repair Markdown FormattingONSITE INTERVIEW · Seen Jun 2024
  • Breadth-First Values of a Binary TreeONSITE INTERVIEW · Seen Oct 2022

Similar questions at other companies

  • Group Transactions by HourAffirm · ONSITE INTERVIEWAffirm interview questions
  • Merge Sorted ArrayDP World · ONSITE INTERVIEW
  • Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions
  • Meeting RoomsGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
  • Sort Products by Aisle With Frozen Items LastInstacart · ONSITE INTERVIEWInstacart interview questions
  • Merge Two Arrays Into Sorted OrderNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Compress Consecutive Integer RangesDocuSign · ONSITE INTERVIEWDocuSign interview questions
  • Filter Anagrams of a TargetMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Rank Transform an ArrayAgoda · ONSITE INTERVIEWAgoda interview questions
  • Filter and Sort Scheduled TasksRippling · ONSITE INTERVIEWRippling interview questions

Figma interview experiences

  • Figma interviews · November 2026
  • Figma SWE Intern OA and Final Round: 21 Experiences
  • Figma SWE Intern OA Questions: 25 Experiences
All Figma interview questionsSee Figma hiring insights
Saved
class Solution {
    public String[] sortDocumentsLeftToRight(String[][] documents) {
      // write your code here
    }

}
Checking account…