Infosys Interview Question

Given a string, determine if the parenthesis are valid.