Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by fed.kz
PAIRS = dict(zip('[({', '])}'))
def checkio(text: str) -> bool:
stack = []
for symb in text:
if symb in '[{(':
stack.append(symb)
elif symb in ']})':
if not stack: return False
if symb != PAIRS[stack.pop()]:
return False
return not stack
Nov. 3, 2018
Comments: