Autodesk interview question

Validate a string of parentheses (leetcode 20)