Skip to content

Commit b0e0afd

Browse files
iamAntimPalAntim-IWPIamShiwangi
committed
Update 2390. Removing Stars From a String.py
Co-Authored-By: Antim-IWP <203163676+Antim-IWP@users.noreply.github.com> Co-Authored-By: Shiwangi Srivastava <174641070+IamShiwangi@users.noreply.github.com>
1 parent 0d36910 commit b0e0afd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def removeStars(self, s: str) -> str:
3+
ans = []
4+
for c in s:
5+
if c == '*':
6+
ans.pop()
7+
else:
8+
ans.append(c)
9+
return ''.join(ans)

0 commit comments

Comments
 (0)