Incedo interview question

write a code for parenthesis check?