Isn’t the “return depth == 0” solution simpler and so superior? (That’s a question, I don’t actually know Python that well.)
A point of taste. My solution makes it explicit what is being checked for: Unclosed parens.
Isn’t the “return depth == 0” solution simpler and so superior? (That’s a question, I don’t actually know Python that well.)
A point of taste. My solution makes it explicit what is being checked for: Unclosed parens.