Problem Description
Given a string A denoting an expression. It contains the following operators '+', '-', '*', '/'
.
Chech whether A has redundant braces or not.
NOTE: A will be always a valid expression.
1 <= |A| <= 105
The only argument given is string A.
Return 1 if A has redundant braces, else return 0.
Input 1:
A = "((a+b))"
Input 2:
A = "(a+(a+b))"
Input 3:
A = "((a*b)+(c+d))"
Output 1:
1
Output 2:
0
Output 3:
0
Explanation 1:
((a+b)) has redundant braces so answer will be 1.
Explanation 2:
(a+(a+b)) doesn't have have any redundant braces so answer will be 0.
Explanation 3:
((a*b)+(c+d)) doesn't have have any redundant braces so answer will be 0.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.