← Questions

Decode a string with nested repeat counts

0
GoogleCodingLast asked Feb 2026

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.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding