Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by vac
def checkio(expression):
st =[]
ob=['(','{','[']
cb=[')','}',']']
for c in expression:
if c in ob:
st.append(c)
else:
if c in cb:
if len(st)==0 or ob.index(st.pop())!=cb.index(c):
return False
return len(st)==0
Jan. 31, 2015
Comments: