bumpsoo 2026-06-16 14:25:04 +00:00
parent 5ee734e9a5
commit dcc322307d

View file

@ -0,0 +1,17 @@
# https://leetcode.com/problems/process-string-with-special-operations-i
class Solution:
def processStr(self, s: str) -> str:
result = []
for ch in s:
match ch:
case '#':
result *= 2
case '%':
result.reverse()
case '*':
if len(result) > 0:
result.pop()
case _:
result.append(ch)
return ''.join(result)