Chatham Financial interview question

Solve Leetcode Easy, 20. Valid Parentheses