Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
stack solution in Clear category for Brackets by karlian
open = "({["
close = ")}]"
def checkio(expression):
stack = []
for c in expression:
if c in open:
stack.append(c)
elif c in close:
if len(stack) == 0:
return False
elif c != close[open.index(stack.pop())]:
return False
return len(stack) == 0
May 22, 2022
Comments: