Category Archives: Strings

Prerequisites: Z-algorithm Given a string S, the task is to find the maximum number of palindromes that can be formed after performing the given steps:… Read More
Given a string S of length N consisting of characters “(“ and “)” only, the task is to convert the given string into a balanced… Read More
One person hands over the list of digits to Mr. String, But Mr. String understands only strings. Within strings also he understands only vowels. Mr.… 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 binary string S of length N, the task is to minimize the count of repetitive removal of alternating subsequence of the 0 and… Read More
Given a string str and an array cost[] of size N where cost[i] denotes the cost to remove the ith character from the string str,… Read More
Given a character array, str[] of consisting of N lowercase alphabets, and an integer array, arr[] consisting of numbers in the range [0, N –… Read More
Given a string S consisting of ‘(‘, ‘)’, ‘[‘ and ‘]’, the task is to find the minimum count of remaining characters in the string… Read More
Given a binary string str, the task is to find the count of ways to partition the string such that each partitioned substring contains exactly… Read More
Given a string S and a character C, the task is to remove all the occurrences of the character C from the given string. Examples:… Read More
Given two strings S and T representing non-negative rational numbers, the task is to check if the values of S and T are equal or… Read More
Prerequisite: Finite Automata Given a string S of size N, the task is to design a Deterministic Finite Automata (DFA) for accepting the language L… Read More
Given a string S of size N consisting of ‘(‘, ‘)’, and ‘$’, the task is to check whether the given string can be converted… Read More
Given an array arr[] of size 26, representing frequencies of character ‘a’ to ‘z’, the task is to find the maximum number of palindromic strings… Read More
Given a numberic string N (1 ≤ |N| ≤ 105) and another numeric string S (1 ≤ |S| ≤ 105), the task is to find… Read More