Expand Nested (group){k} Repeats

Asked at Waymo · Coding Questions · Difficulty: Medium · Last asked May 13, 2026

A compact text format writes a repeated chunk as a parenthesized group followed by its repeat count in braces. Given a string in this format, produce the fully expanded text.

Loading the problem…