MongoDB interview question

Write an algorithm to determine if a string of brackets are valid