leetcode844】的更多相关文章

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". Exam…
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". Exam…
class Solution { public: bool backspaceCompare(string S, string T) { stack<char> ST1; ; i < S.length(); i++) { char c = S[i]; if (c == '#') { if (!ST1.empty()) { ST1.pop(); } } else { ST1.push(c); } } stack<char> ST2; ; i < T.length(); i…
给定 S 和 T 两个字符串,当它们分别被输入到空白的文本编辑器后,判断二者是否相等,并返回结果. # 代表退格字符. 示例 1: 输入:S = "ab#c", T = "ad#c" 输出:true 解释:S 和 T 都会变成 "ac". 示例 2: 输入:S = "ab##", T = "c#d#" 输出:true 解释:S 和 T 都会变成 "". 示例 3: 输入:S = &quo…
""" 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 &…
题目描述: 给定 S 和 T 两个字符串,当它们分别被输入到空白的文本编辑器后,判断二者是否相等,并返回结果. # 代表退格字符. 示例 1: 输入:S = "ab#c", T = "ad#c" 输出:true 解释:S 和 T 都会变成 "ac". 示例 2: 输入:S = "ab##", T = "c#d#" 输出:true 解释:S 和 T 都会变成 "". 示例 3: 输入:S…
简单题 1. 有效的括号(leetcode-20) 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效. 有效字符串需满足: 1. 左括号必须用相同类型的右括号闭合. 2. 左括号必须以正确的顺序闭合. 3. 注意空字符串可被认为是有效字符串. 示例 1: 输入: "()" 输出: true 示例 2: 输入: "()[]{}" 输出: true 示例 3: 输入: "(]" 输出: false 示例 4…