Bloomberg interview question

Implement an algorithm that checks if a sequence of brackets is valid.