Decode a string with nested repeat counts

0
Remix

An encoded string uses k[...] to mean the bracketed part repeated k times, and brackets may nest, for example 3[a2[c]] decodes to accaccacc. Return the decoded string. Use a stack or recursion and handle multi-digit counts.

GoogleCodingLast asked Feb 2026
No answer yet. Write the first one; the best answer gets endorsed.