Redundant Braces

Write a program to validate if the input string has redundant braces?
Return 0/1
0 -> NO 1 -> YES

Input will be always a valid expression

and operators allowed are only + , * , - , /

Example:

((a + b)) has redundant braces so answer will be 1
(a + (a + b)) doesn't have have any redundant braces so answer will be 0

Interview Code Editor
Hints
  • Hint 1
  • Solution Approach
  • Complete Solution
5211 successful submissions.
Asked In:
  • Amazon
Click here to jump start your coding interview preparation