September 30, 2024 |20 Views

    PROBLEM OF THE DAY : 18/09/2024 | Parenthesis Checker

    Description
    Discussion

    Welcome to the daily solving of our PROBLEM OF THE DAY with Devashish Khare We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Stack but also build up problem-solving skills.

    Given an expression string x. Examine whether the pairs and the orders of {,},(,),[,] are correct in exp.
    For example, the function should return 'true' for exp = [()]{}{[()()]()} and 'false' for exp = [(]).

    Note: The driver code prints "balanced" if function return true, otherwise it prints "not balanced".

    Examples :

    Input: {([])} Output: true Explanation: { ( [ ] ) }. Same colored brackets can form balanced pairs, with 0 number of unbalanced bracket.

    Give the problem a try before going through the video. All the best!!!
    Problem Link: https://practice.geeksforgeeks.org/problems/parenthesis-checker2744/1