844. Backspace String Compare Easy
1/**
2 * [844] Backspace String Compare
3 *
4 * Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.
5 * Note that after backspacing an empty text, the text will continue empty.
6 *
7 * Example 1:
8 *
9 * Input: s = "ab#c", t = "ad#c"
10 * Output: true
11 * Explanation: Both s and t become "ac".
12 *
13 * Example 2:
14 *
15 * Input: s = "ab##", t = "c#d#"
16 * Output: true
17 * Explanation: Both s and t become "".
18 *
19 * Example 3:
20 *
21 * Input: s = "a#c", t = "b"
22 * Output: false
23 * Explanation: s becomes "c" while t becomes "b".
24 *
25 *
26 * Constraints:
27 *
28 * <span>1 <= s.length, t.length <= 200</span>
29 * <span>s and t only contain lowercase letters and '#' characters.</span>
30 *
31 *
32 * Follow up: Can you solve it in O(n) time and O(1) space?
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/backspace-string-compare/
38// discuss: https://leetcode.com/problems/backspace-string-compare/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn backspace_compare(s: String, t: String) -> bool {
44 false
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_844() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.