Pergunta de entrevista da empresa Apple

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