LeetCode 솔루션 분류
[5/1] 844. Backspace String Compare
본문
[LeetCode 시즌 3] 2022년 5월 1일 문제입니다.
https://leetcode.com/problems/backspace-string-compare/
[Easy] 844. Backspace String Compare
Given two strings s
and t
, return true
if they are equal when both are typed into empty text editors. '#'
means a backspace character.
Note that after backspacing an empty text, the text will continue empty.
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 = "b" Output: false Explanation: s becomes "c" while t becomes "b".
Constraints:
1 <= s.length, t.length <= 200
s
andt
only contain lowercase letters and'#'
characters.
Follow up: Can you solve it in O(n)
time and O(1)
space?
태그
#LeetCode, #IBM, #Booking.com, #Apple, #Visa, #Google, #Bloomberg, #tiktok, #Two Pointers, #String, #Stack, #Simulation
관련자료
-
링크
댓글 4
mingki님의 댓글
- 익명
- 작성일
C++
Runtime: 4 ms, faster than 29.77% of C++ online submissions for Backspace String Compare.
Memory Usage: 6.1 MB, less than 88.27% of C++ online submissions for Backspace String Compare.
Runtime: 4 ms, faster than 29.77% of C++ online submissions for Backspace String Compare.
Memory Usage: 6.1 MB, less than 88.27% of C++ online submissions for Backspace String Compare.
austin님의 댓글
- 익명
- 작성일
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Backspace String Compare.
Memory Usage: 6.3 MB, less than 68.20% of C++ online submissions for Backspace String Compare.
Memory Usage: 6.3 MB, less than 68.20% of C++ online submissions for Backspace String Compare.