The redundant parentheses problem

how to solve it?please help me in the approach