注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
OA抽到的coding题目是解析缩略字符串,和蠡口散酒寺相似。
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. Note that k is guaranteed to be a positive integer.
You may assume that tstack.pop()
stack.append(str2 + str1 * rep)
else:
stack[-1] += s[it]
it += 1
return "".join(stack) |