top of page
balanced.png

Check for balanced parentheses in an expression

Problem : 

You are given a string s consisting of characters: (, ), [, ], { and }. Write a program to check whether the characters in the string s are valid or not.

Problem Note : 

  • A string is said to be valid if an open parenthesis is closed by the same type of parenthesis.

  • Also, the open parenthesis must be closed in the correct order.

  • Return Balanced Expression, if the string is valid, else return UnBalanced Expression.

Example : 

 

Input: " ( ( [ ] ( ) { } ) ) "

 

Output: Balanced Expression

​

Explanation: In the above example, every parenthesis and bracket has opening and closing in the correct order. Thus, we get Balanced Expression(true) as output.

Solution :

balanced_1[1].jpg
balanced_2[1].jpg
balanced_3[1].jpg

First Screen is the landing page of the application.

the second Screen, Enter your expression and just click the button CHECK EXPRESSION

third Screen, tells you about the result 

bottom of page