1
2
3
4
5
6
7
8
9
10
11
12
13
|
def sol(s):
for i in range(len(s)):
if '#' in s :
if s[0]=='#' : s=s[1:]
else :
s = s[:s.find('#') - 1] + s[s.find('#') + 1:]
else : break
return s
class Solution:
def backspaceCompare(self, s: str, t: str) -> bool:
if sol(s)== sol(t) : return True
else: return False
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
codeforces 1030A - In Search of an Easy Problem (0) | 2022.05.11 |
---|---|
leetcode 1679. Max Number of K-Sum Pairs (0) | 2022.05.04 |
leetcode 905. Sort Array By Parity (0) | 2022.05.02 |
codeforces 1352A - Sum of Round Numbers (0) | 2022.05.02 |
codeforces 1335A - Candies and Two Sisters (0) | 2022.05.02 |
댓글