bumpsoo 2025-02-10 13:42:36 +00:00
parent fcaf05a364
commit 43527186ef

13
easy/clear_digits.py Normal file
View file

@ -0,0 +1,13 @@
# https://leetcode.com/problems/clear-digits
class Solution:
def clearDigits(self, s: str) -> str:
stack = []
for i in range(len(s)):
if '0' <= s[i] and s[i] <= '9':
stack.pop()
else:
stack.append(s[i])
return ''.join(stack)