Boston Consulting Group Interview Question

solve a bracket sequence problem — check whether successive brackets are valid / balanced using stack logic