Skip to content

Commit 1983c80

Browse files
committed
5-4-24
1 parent ef5f228 commit 1983c80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Apr-5-24.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def makeGood(self, s: str) -> str:
3+
stk = []
4+
if(len(s)==1):
5+
return s
6+
stk.append(s[0])
7+
for i in range(1,len(s)):
8+
if(len(stk)!=0 and (abs(ord(stk[-1])-ord(s[i]))==32)):
9+
stk.pop(-1)
10+
else:
11+
stk.append(s[i])
12+
s = ""
13+
for i in stk:
14+
s+=i
15+
return s

0 commit comments

Comments
 (0)