HARMAN interview question

In dsa they asked valid parenthesis problem