MulticoreWare interview question

Check whether the given parentheses is valid or not