LeetCode 筆記 - 844. Backspace String Compare Posted on 2022-05-15 Edited on 2023-06-01題目在此 844. Backspace String Compare給定兩個字串,請判斷處理完退位鍵 # 是否相等解題思維抱歉,我不知道可以解釋什麼…程式碼12345678910111213141516class Solution: def backspaceCompare(self, s: str, t: str) -> bool: def get_string(string: str) -> str: while '#' in string: index = string.find('#') if index == 0: string = string[1:] else: string = f'{string[:index - 1]}{string[index + 1:]}' return string s = get_string(s) t = get_string(t) return s == t