Microsoft interview question

1. find if a given string has valid paranthesis