Back to course home
0% completed
Vote For New Content
Simple Python Solution
Pete Stenger
Sep 19, 2024
This solution doesn't need to reconstruct the counts. stack = [] for c in s: if stack and stack[-1][-1] == c: stack[-1] += c else: stack.append(c) if stack and len(stack[-1]) == k: stack.pop() return "".join(stack)
0
0
Comments
Comments