Electric Mind Interview Question

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