有效的括号
![在这里插入图片描述](https://img-blog.csdnimg.cn/c7a7d02ce50a43879410b3ce4c53b902.png#pic_center)
实现思路
代码实现
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
n=len(s)
for i in range(0,n-1):
if s[i]=='(' and s[i+1]!=')':
return False
if s[i]=='[' and s[i+1]!=']':
return False
if s[i]=='{' and s[i+1]!='}':
return False
return True