Pregunta de entrevista de Apple

Given a string, determine if the parentheses and brackets are balanced