Decode String — JavaScript medium interview problem
Given an encoded string, return its decoded string. The encoding rule is: `k[encoded_string]`, where the `encoded_string` inside the square brackets is being repeated exactly `k` times. `k` is guaranteed to be a positive integer. You may assume the input is always valid (no extra spaces, brackets well-formed). Example: `decodeString("3[a]2[bc]")` → `"aaabcbc"`.
Tags: stack, parsing
Practice this Strings problem free in the JS Interview Playground with automated tests and unlockable solutions.