MongoDB Interview Question

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