Netflix interview question

Check if a string has valid parenthesis