Meta interview question

Valid Parentheses and tree traversal