Medium · Stacks & Queues
Decode String
Given a valid encoded string s of lowercase letters, digits and square brackets, where k[text] stands for text repeated k times (k ≥ 1, groups may nest), return the decoded string.
Examples
Example 1
{
"s": "3[a2[c]]"
}Output: "accaccacc"
Example 2
{
"s": "2[abc]3[cd]ef"
}Output: "abcabccdcdcdef"
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.