Tag Archives: Parentheses-Problems

Given a string str consisting of pairs of balanced parentheses, the task is to calculate the score of the given string based on the following… Read More
Given a string str, the task is to find the maximum count of pairs (str[i], str[j]) of balanced parenthesis required to be removed such that… Read More
Given a valid parenthesis string str consisting of lowercase alphabets, opening, and closing brackets, the task is to find the string by removing the outermost… Read More
Given a string S of length N, consisting of only opening ‘(‘ and closing ‘)‘ parenthesis. The task is to find all indices ‘K‘ such… Read More
Given a string str of length N, the task is to find the number of ways to insert only 2 pairs of parentheses into the… Read More
Given an expression with only ‘}’ and ‘{‘. The expression may not be balanced. The task is to find minimum number of bracket reversals to… Read More
Given a string str consisting of characters ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘ and ‘}’ only. The task is to find the maximum length of the… Read More
Given an expression string, write a python program to find whether a given string has balanced parentheses or not. Examples: Input : {[]{()}} Output :… Read More
Given N bracket sequences, the task is to find the number of pairs of bracket sequences by joining which can be obtained a balanced bracket… Read More
Given a string str comprising of characters (, ), {, }, [, ] and ?. The task is to find the total number of balanced… Read More
Given an incomplete bracket sequence S. The task is to find the number of closing brackets ‘)’ needed to make it a regular bracket sequence… Read More
Given a string ‘S’ consisting of open and closed brackets, the task is find the number of ways in which each character of ‘S’ can… Read More
Given a number N representing the length of a bracket sequence consisting of brackets ‘(‘, ‘)’. The actual sequence is not known beforehand. Given the… Read More
Given a string S of parentheses ‘(‘ or ‘)’ where, . The task is to find minimum number of parentheses ‘(‘ or ‘)’ (at any… Read More