Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by oba-ba
def checkio(expression):
bracket_set = {"{": "}", "(": ")", "[": "]"}
stack = []
for char in expression:
if char in bracket_set:
stack.append(char)
elif char in bracket_set.values():
if stack and bracket_set.get(stack[-1]) == char:
stack.pop()
else:
return False
return False if stack else True
June 5, 2019