This problem is one of the standard use case scenario when learning or practicing Stack as a Data Structure, if we are familiar with the basic operarions with stack like push() and pop(), this problem can be solved very easily. All we need to know is that for every opening bracket there needs to be a closed one.
Example:
Input: (a+b)(a-b)
Output : Balanced
Input : ((a+b)(a-b)
Output : Not Balnced
Solution Approach
The two main operations of a Stack Data Structure i.e Push() and Pop() are us...
Published on November 13, 2020 09:32