Decode a Nested Repeat String

medium
Unit 17 · Greedy & Trees0/3 to milestone

Decode strings like 3[a2[c]] → accaccacc: k[...] repeats the bracketed part k times (k can have several digits), and brackets nest. Implement decode(s) with a stack, in time proportional to the output length.

#stacks#parsing#recursion2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Decode a Nested Repeat String · TechGradify