0 votes 0 votes A problem called Boolean Parenthesis Matching (match all parenthesis in an expression) can be solved by: Greedy Approach Recursion Dynamic Approach Both [B] and [C] Algorithms tbb-algorithms-2 + – Bikram asked May 26, 2017 edited Aug 20, 2019 by Counsellor Bikram 437 views answer comment Share Follow See all 9 Comments See all 9 9 Comments reply Show 6 previous comments Bikram commented May 31, 2017 reply Follow Share Be more specific , how you conclude to this statement ? and before that how you thought like that please elaborate .. it will help . 0 votes 0 votes shraddha priya commented May 31, 2017 reply Follow Share Sir, the code above generates all possible pairs of parenthesis. So if the parenthesis in the given expression match with one of the generated ones then we can conclude that we have balanced parenthesis , can't we? This way we have a recursive sol, isn't it? Alternatively, if we scan the expression and use a stack to push open parenthesis and pop it when a closed parenthesis comes, we can say we have balanced parenthesis. Please correct me if I'm wrong. 1 votes 1 votes Bikram commented Aug 30, 2017 reply Follow Share @ shraddha Yes , you are correct.. 0 votes 0 votes Please log in or register to add a comment.
Best answer 0 votes 0 votes it is a dynamic programming problem though we can use recursive approach .. so both option B and C are possible. Bikram answered May 26, 2017 selected Aug 20, 2019 by Bikram Bikram comment Share Follow See 1 comment See all 1 1 comment reply Rishabh Gupta 2 commented Aug 30, 2017 reply Follow Share For creating a dynamic programming solution for any problem, we first create its recursive solution. So, it can also be solved recursively. It won't be efficient, but the question asks if it can be solved or not. 1 votes 1 votes Please log in or register to add a comment.