Domanda di colloquio di Electric Mind

Write a function which can tell the given String has balanced brackets?