Technical interview problem for determining whether the brackets/parenthesis in a string are balanced