You are viewing a single comment's thread. Return to all comments →
def isBalanced(s): restart=True while restart: if '{}' in s: s=s.replace('{}','') elif '()' in s: s=s.replace('()','') elif '[]' in s: s=s.replace('[]','') else: restart=False return 'YES' if len(s)==0 else 'NO'
Seems like cookies are disabled on this browser, please enable them to open this website
Balanced Brackets
You are viewing a single comment's thread. Return to all comments →