Closed notmaster closed 4 years ago
394.字符串解码.js
遍历字符串 s ,获取字符 c
当 c in ['0'-'9'], 拼接到重复数量 multi ,用于倍数计算
当 c in ['a'-'z','A'-'Z'],拼接到 str
当 c === '[' 将 multi 和 str 入栈,并置空
当 c === ']' , strStack 出栈,拼接字符串 res = lastStr + curMulti * str
返回 str
时间复杂度 O(n)