Atlassian interview question

Detect if a string of parenthesis is balanced