[LC] Add solution to valid parentheses.