Skip to content

Commit cf6270c

Browse files
committed
Feb 10
1 parent 9005a28 commit cf6270c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Solution:
2+
def clearDigits(self, s: str) -> str:
3+
stack = []
4+
for ch in s:
5+
if ch.isdigit():
6+
if stack:
7+
stack.pop()
8+
else:
9+
stack.append(ch)
10+
return ''.join(stack)
11+
12+
13+
def main():
14+
s = 'abc'
15+
assert Solution().clearDigits(s) == 'abc'
16+
17+
s = 'cb34'
18+
assert Solution().clearDigits(s) == ''
19+
20+
21+
if __name__ == '__main__':
22+
main()

2025-02-February-LeetCoding-Challenge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| February 07 | [3160. Find the Number of Distinct Colors Among the Balls](https://leetcode.com/problems/find-the-number-of-distinct-colors-among-the-balls/) | Medium | Solved |
1414
| February 08 | [2349. Design a Number Container System](https://leetcode.com/problems/design-a-number-container-system/) | Medium | Solved |
1515
| February 09 | [2364. Count Number of Bad Pairs](https://leetcode.com/problems/count-number-of-bad-pairs/) | Medium | Solved |
16-
| February 10 | []() | | |
16+
| February 10 | [3174. Clear Digits](https://leetcode.com/problems/clear-digits/) | Easy | Solved |
1717
| February 11 | []() | | |
1818
| February 12 | []() | | |
1919
| February 13 | []() | | |
@@ -37,6 +37,6 @@
3737
## Summary
3838
| Level | Problems | Solved | Unsolved |
3939
| --- | --- | --- | --- |
40-
| Easy | 5 | 5 | 0 |
40+
| Easy | 6 | 6 | 0 |
4141
| Medium | 4 | 4 | 0 |
4242
| Hard | 0 | 0 | 0 |

0 commit comments

Comments
 (0)