Problem
Two strings s and t are typed into blank text editors. The character # means backspace: it deletes the character before it, if there is one (backspacing an empty editor does nothing). Return true if both editors end up showing the same text.
Example 1
- Input
- s = "ab#c", t = "ad#c"
- Output
- true
- Why
- both become "ac"
Example 2
- Input
- s = "ab##", t = "c#d#"
- Output
- true
- Why
- both become ""
Example 3
- Input
- s = "a#c", t = "b"
- Output
- false
- Why
- "c" vs "b"
Can you do it in O(1) extra space, without building the final strings?
Constraints
1 <= s.length, t.length <= 200s and t contain only lowercase letters and #.