FastPrepExecute Cursor-Based Text Editor Operations
Problems/Execute Cursor-Based Text Editor Operations

Execute Cursor-Based Text Editor Operations

DocuSign logoDocuSign● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the main task and the interview setting. We chose the function signature, a fixed tie rule, the examples, and the input limits. Our version is about 90% the same as the reported question.

Start with an empty document and cursor position 0. Each command is [operation,argument].

  • INSERT text inserts at the cursor and moves past it.
  • LEFT x and RIGHT x move without crossing an edge.
  • BACKSPACE x removes up to x characters immediately left of the cursor and moves to the deletion start.
  • DELETE x removes up to x characters immediately right of the cursor without moving it.
  • PRINT x records characters at indices from cursor-x through cursor+x, inclusive and clipped to the document.

Return recorded strings in print order.

Function

getPrintedStrings(commands: String[][]) → String[]

Examples

Example 1

commands = [["Insert","addthis"],["Print","5"],["Left","4"],["Right","2"],["Backspace","1"],["Delete","1"],["Print","10"]]return = ["dthis","addts"]

The print results are dthis and addts.

Example 2

commands = [["Insert","abc"],["Left","2"],["Insert","XY"],["Print","3"]]return = ["aXYbc"]

Insertion at cursor one creates aXYbc and the cursor sits after XY.

Example 3

commands = [["Print","2"]]return = [""]

Printing an empty document records an empty string.

Constraints

  • 1 <= commands.length <= 5000.
  • The total inserted length is at most 5000.
  • Numeric arguments are nonnegative decimal integers.

More DocuSign Phone Screen questions

  • Symmetric Binary TreePHONE SCREEN · Seen Oct 2026
  • Union Area of Two RectanglesPHONE SCREEN · Seen Oct 2026
  • Minimize Array Sum After K Halving OperationsPHONE SCREEN · Seen Sep 2026
  • Fizz and Buzz Words From 1 to nPHONE SCREEN · Seen Sep 2026
  • Two Positions That Add Up to a TargetPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Rain Kept Between WallsPHONE SCREEN · Seen Mar 2026
  • Exact Palindrome CheckPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Reverse the Characters of a TextPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Rebuild a Trip From Flight TicketsPHONE SCREEN · Seen Apr 2019
  • Find the Words for Each PrefixPHONE SCREEN · Seen Sep 2018

Similar questions at other companies

  • Business Account KYC Verification — Parts 1–5Stripe · PHONE SCREENStripe interview questions
  • Minimum Number of Frogs CroakingCerebras · PHONE SCREEN
  • Adjacent Pair and Run RemovalWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Read Across Sound TracksAirbnb · PHONE SCREENAirbnb interview questions
  • Stateful Log Transform and SearchRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • K-Step Bit Flip with RetentionCisco · PHONE SCREENCisco interview questions
  • Elevator Scheduling SimulationOpenAI · PHONE SCREENOpenAI interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions

DocuSign interview experiences

  • DocuSign SWE Intern Interviews: 27 Experiences (Part 2 of 2)
  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)
All DocuSign interview questionsSee DocuSign hiring insights
Saved
class Solution {
    public String[] getPrintedStrings(String[][] commands) {
        // write your code here
    }
}
Checking account…