Brex Interview Question

LC Easy, Valid Parentheses problem