
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](https://static.wixstatic.com/media/4fdaed_5be4bc11876b455b953b2ea35e9e120f~mv2.jpg/v1/fill/w_178,h_396,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/balanced_1%5B1%5D.jpg)
![balanced_2[1].jpg](https://static.wixstatic.com/media/4fdaed_3c71a3b0216e48ab900efab704090bd9~mv2.jpg/v1/fill/w_178,h_396,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/balanced_2%5B1%5D.jpg)
![balanced_3[1].jpg](https://static.wixstatic.com/media/4fdaed_deaef23a8b4c46d6b0441e7509a18293~mv2.jpg/v1/fill/w_178,h_396,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/balanced_3%5B1%5D.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