Domanda di colloquio di Capital One

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