Check redundant brackets

Given a string mathematical expression, return true if redundant brackets are present in the expression. Brackets are redundant if there is nothing inside the bracket or more than one pair of brackets are present.

Assume the given string expression is balanced and contains only one type of bracket i.e. ().

Sample Input 1:

((a + b)) 

Sample Output 1:

true

Sample Input 2:

(a+b) 

Sample Output 1:

false

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem