Challenge 9: Check for Balanced Parentheses using a Stack
Try to solve the Valid Parentheses problem.
Statement
Given a string, exp, which may consist of opening and closing parentheses. Your task is to check whether or not the string contains valid parenthesization.
The conditions to validate are as follows:
- Every opening parenthesis should be closed by the same kind of parenthesis. Therefore, - {)and- [(])strings are invalid.
- Every opening parenthesis must be ...