Text Editor
Given a string s
representing characters typed into an editor, with "<-"
representing a backspace, return the current state of the editor.
Constraints
n ≤ 100,000
wheren
is the length ofs
https://binarysearch.com/problems/Text-Editor
Examples
Example 1
Input
- s =
abc<-z
Output
- answer =
abz
Explanation
The “c” got deleted by the backspace.
Example 2
Input
- s =
<-x<-z<-
Output
- answer = ``
Explanation
All characters are deleted. Also note you can type backspace when the editor is empty as well.
Leave a comment