Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by tokiojapan55
def checkio(expression):
OPEN,CLOSE = '({[',')}]'
stack = []
for c in expression:
if c in OPEN:
stack.append(OPEN.index(c))
if c in CLOSE:
if not stack or stack.pop()!=CLOSE.index(c):
return False
return not stack
June 23, 2020
Comments: