design text editor cursor followingAdd text cursor isDelete text cursor simulate backspace keyMove cursor leave rightwhen delete text character leave cursor delete the cursor remain actual text move more formally 0 cursorposition currenttextlength holdsimplement TextEditor classtexteditor initialize object textvoid addtextstre text Appends text cursor the cursor end right textint deletetextint k Deletes k character leave cursor Returns number character actually deletedstre cursorLeftint k Moves cursor leave k time Returns min10 len character leave cursor len number character leave cursorstre cursorrightint k Moves cursor right k time Returns min10 len character leave cursor len number character leave cursor Example 1inputtexteditor addtext deletetext addtext cursorright cursorleft deletetext cursorLeft cursorright leetcode 4 practice 3 8 10 2 6outputnull null 4 null etpractice leet 4 practiExplanationTextEditor texteditor new TextEditor the current text the character represent cursortexteditoraddtextleetcode the current text leetcodetexteditordeletetext4 return 4 the current text leet 4 character deletedtexteditoraddtextpractice the current text leetpractice texteditorcursorright3 return etpractice the current text leetpractice the cursor move actual text etpractice 10 character leave cursortexteditorcursorleft8 return leet the current text leetpractice leet min10 4 4 character leave cursortexteditordeletetext10 return 4 the current text practice only 4 character deletedtextEditorcursorLeft2 return the current text practice the cursor move actual text min10 0 0 character leave cursortexteditorcursorright6 return practi the current text practice practi min10 6 6 character leave cursor Constraints1 textlength k 40text consists lowercase English lettersat 2 104 call total addtext deletetext cursorLeft cursorright Followup could find solution time complexity ok