Backspace String Compare
Compare two typed texts where
01The problem
Two strings are typed into empty text editors, where # means backspace. Return true if both editors end up with the same text. Backspace on an empty editor does nothing. Can you do it in O(1) extra space?
| s | t | Output | Why |
|---|---|---|---|
"ab#c" | "ad#c" | true | both "ac" |
"a#c" | "b" | false | "c" vs "b" |
Constraints: length 1 to 200, lowercase letters and #.
Loading the rest of the lesson…