Question: Given an expression string x . Examine whether the pairs and the orders of { , } , ( , ) , [ , ]
Given an expression string x Examine whether the pairs and the orders of are correct in expression. For example, the function should return 'BALANCED' for expression and 'NOT BALANCED' for expression Input Format: You will be given a string denoting the given expression Output Format: print BALANCED if given expression is valid other wise print NOT BALANCED Sample Test Case : Input: Output: true Explanation: Same colored brackets can form balanced pairs, with number of unbalanced brackets left. Sample Test Case : Input: Output: false Explanation: Here square bracket is balanced but the small bracket is not balanced and Hence the output will be unbalanced. Show it on C program code Given an expression string mathbfx Examine whether the pairs and the orders of are correct in expression.
For example, the function should return 'BALANCED' for expression and 'NOT BALANCED' for expression
Input Format: You will be given a string denoting the given expression
Output Format: print "BALANCED" if given expression is valid other wise print "NOT BALANCED"
Sample Test Case :
Input:
Output: true
Explanation: Same colored brackets can form balanced pairs, with number of unbalanced brackets left.
Sample Test Case :
Input:
Output: false
Explanation: Here square bracket is balanced but the small bracket is not balanced and Hence the output will be unbalanced.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
