题解 | #括号序列#
括号序列
http://www.nowcoder.com/practice/37548e94a270412c8b9fb85643c8ccc2
class Solution:
def isValid(self , s ):
# write code here
stack = []
match = {'(':')', '[':']','{':'}'}
for i in s:
if i in match:
stack.append(i)
else:
if not stack or match[stack.pop()] != i:
return False
return not stack
安克创新 Anker公司福利 800人发布
