Question: Given an expression string exp, write a program to examine whether the pairs and the orders of {, }, (, ), [, ] are correct

Given an expression string exp, write a program to examine whether the pairs and the orders of {, }, (, ), [, ] are correct in exp.

This is a very common task for the compilers.

Example: Input: exp = [()]{}{[()()]()} Output: Balanced

Input: exp = [(]) Output: Not Balanced

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!