class Solution:
def isValid(self, s: str) -> bool:
match = {'}':'{',')':'(',']':'['}
stack = []
if len(s)%2 == 1:
return False
for ch in s:
if ch in ['(','[','{']:
stack.append(ch)
return True
else: #ch in {')','}',']'}
if len(stack) <=0:
return False
elif stack[-1] == match[ch]:
return stack.pop()
else:
return False
if len(stack)==0:
return True
else:
return False
你的题目是什么?