标签:python 执行 return == 提交 div decode mda pen
这道题也不是我自己做出来的,只能说大佬牛逼!!!
class Solution(object): def decodeString(self, s): """ :type s: str :rtype: str """ stack, res, multi = [], "", 0 for c in s: if c == ‘[‘: stack.append([multi, res]) res, multi = "", 0 elif c == ‘]‘: cur_multi, last_res = stack.pop() res = last_res + cur_multi * res elif ‘0‘ <= c <= ‘9‘: multi = multi * 10 + int(c) else: res += c return res
标签:python 执行 return == 提交 div decode mda pen
原文地址:https://www.cnblogs.com/taoyuxin/p/11793468.html