Given a string s consisting of parentheses {‘(‘ and ‘)’} and integers, the task is to construct a Binary Tree from it and print its… Read More

# Tag Archives: Parentheses-Problems

Given a string S of size N consisting of only ‘(‘ and ‘)’ only and a positive integer K, the task is to check if… Read More

Given string str of length N, consisting of pairs of balanced parentheses, the task is to calculate the score of the given string based on… Read More

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 bracket sequence as a string str, the task is to find whether the given string can be balanced by moving at most one… 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