Back to problems

Design a Text Editor

Object-Oriented Programming · Harvey · Medium

Design a text editor that maintains a cursor and supports inserting text, deleting characters immediately to the left of the cursor, and moving the cursor left or right. Implement the TextEditor class: TextEditor() Initializes the editor with no text. void addText(string text) Appends text directly to the left of the cursor. After insertion, the cursor stays positioned after the newly added text. int deleteText(int k) Removes up to k characters immediately to the left of the…

Checking your access…