Decode String
Medium
Strings
String
Stack
Recursion
Decode encoded string like 3[a2[c]] → accaccacc.
Constraints
1 ≤ s.length ≤ 30
Examples
Example 1:
Input: 3[a]2[bc]
Output: aaabcbc
Example 2:
Input: 3[a2[c]]
Output: accaccacc
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console