This is a verified interview question from Ms-(microsoft). Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Get Printed Strings" covers key patterns like Strings.
"You are given a 2D array of commands. Each command is a string of the form [operation, argument]. The possible values for operation are: "Insert", "Delete", "Backspace", and "Print". The argument is a string for "Insert" and an integer for the other operations. For "Insert", insert the argument string at the current cursor position. For "Delete" and "Backspace", remove the specified number of characters to the right/left of the cursor. For "Print", print the string from the current cursor position for the specified length. Implement the getPrintedStrings function to return an array of printed strings."
Join thousands of developers practicing for Ms-(microsoft).