Skip to content

Commit e0e259f

Browse files
authored
python always looks better
1 parent a499fe9 commit e0e259f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.
3+
'''
4+
5+
class Solution(object):
6+
def backspaceCompare(self, S, T):
7+
def build(S):
8+
ans = []
9+
for i in S:
10+
if i != '#':
11+
ans.append(c)
12+
elif ans:
13+
ans.pop()
14+
return "".join(ans)
15+
return build(S) == build(T)

0 commit comments

Comments
 (0)