Tango Tree Data Structure
Tango Tree is a data structure for efficient dynamic connectivity and range minimum/maximum query on a set of elements. It is a type of balanced binary search tree that uses finger trees as the underlying data structure to achieve fast and efficient operations. The Tango Tree is designed to support both fast insertions and deletions as well as fast minimum/maximum query operations in a dynamic setting....
read more
Print the string obtained after removal of outermost parentheses
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 enclosing brackets such that the string remains a valid parenthesis string....
read more
Maximize cost obtained by removal of substrings “pr” or “rp” from a given String
Given a string str and two integers X and Y, the task is to find the maximum cost required to remove all the substrings “pr” and “rp” from the given string, where removal of substrings “rp” and “pr” costs X and Y respectively....
read more
Count substrings of a given string whose anagram is a palindrome
Given a string S of length N containing only lowercase alphabets, the task is to print the count of substrings of the given string whose anagram is palindromic....
read more
Check if a Palindromic String can be formed by concatenating Substrings of two given Strings
Given two strings str1 and str2, the task is to check if it is possible to form a Palindromic String by concatenation of two substrings of str1 and str2....
read more
Distinct palindromic sub-strings of the given string using Dynamic Programming
Given a string str of lowercase alphabets, the task is to find all distinct palindromic sub-strings of the given string....
read more
Check if a string contains a palindromic sub-string of even length
S is string containing only lowercase English alphabets. We need to find if there exists at least one palindromic sub-string whose length is even....
read more
Partition string into two substrings having maximum number of common non-repeating characters
Given a string str, the task is to find the maximum count of common non-repeating characters that can be obtained by partitioning the given string into two non-empty substrings....
read more
Length of longest substring to be deleted to make a string equal to another string
Given two strings str1 and str2, where str2 is a subsequence of str1, the task is to find the length of the longest substring of str1 which when removed, makes the strings str2 and str1 equal....
read more
Reverse substrings between each pair of parenthesis
Given a string str that consists of lowercase English letters and brackets. The task is to reverse the substrings in each pair of matching parentheses, starting from the innermost one. The result should not contain any brackets....
read more
Split string into three palindromic substrings with earliest possible cuts
Given string str, the task is to check if it is possible to split the given string S into three palindromic substrings or not. If multiple answers are possible, then print the one where the cuts are made the least indices. If no such possible partition exists, then print “-1”....
read more
Count substrings consisting of equal number of a, b, c and d
Given a string str, the task is to count non-empty substrings with equal number of ‘a’, ‘b’, ‘c’, and ‘d’....
read more