[LeetCode] Backspace String Compare 回车字符串比较
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Backspace String Compare 回车字符串比较相关的知识,希望对你有一定的参考价值。
Given two strings S
and T
, return if they are equal when both are typed into empty text editors. #
means a backspace character.
Example 1:
Input: S = "ab#c", T = "ad#c"
Output: true
Explanation: Both S and T become "ac".
Example 2:
Input: S = "ab##", T = "c#d#"
Output: true
Explanation: Both S and T become "".
Example 3:
Input: S = "a##c", T = "#a#c"
Output: true
Explanation: Both S and T become "c".
Example 4:
Input: S = "a#c", T = "b"
Output: false
Explanation: S becomes "c" while T becomes "b".
Note:
1 <= S.length <= 200
1 <= T.length <= 200
S
andT
only contain lowercase letters and‘#‘
characters.
Follow up:
- Can you solve it in
O(N)
time andO(1)
space?
s
参考资料:
https://leetcode.com/problems/backspace-string-compare/
以上是关于[LeetCode] Backspace String Compare 回车字符串比较的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode - Backspace String Compare
Leetcode_easy844. Backspace String Compare
[LeetCode] 844. Backspace String Compare
[LeetCode] Backspace String Compare 回车字符串比较