Pergunta de entrevista da empresa Capital One

Given a string, implement a function to determine if it has matching/balanced brackets.