Skip to content

Tag Archives: substring

Given two strings S and T of length N and M respectively, the task is to count the number of ways of obtaining same-length substring… Read More
Given a numerical string S of length N, the task is to find the length of the longest substring of S where each element occurs… Read More
Given numerical string str consisting of N integers, the task is to find the sum of all possible resulting strings after removing non-empty substrings. Examples:… Read More
Given a string S of valid parentheses “(“ and “)”, the task is to print the string obtained by removing the outermost parentheses of every… Read More
Given a string str of length N and a substring pattern of length M, the task is to find the frequency of occurrences of pattern… Read More
Given a binary string S of length N, the task is to find the minimum number of removal of adjacent similar characters required to empty… Read More
Given an array of strings arr[], the task is to find the pair of strings from the given array whose length of the longest common… Read More
Given two binary strings A and B, the task is to find the minimum number of times a substring starting from the first character of… Read More
Given a string S, the task is to find the length of the longest substring between any pair of occurrences of same character. Examples: Input:… Read More
Given a string S of length N consisting of lowercase letters and an integer K, where N % K = 0, the task is to… Read More
Given an array of strings S[] consisting of N distinct strings of length M. The task is to generate the longest possible palindromic string by… Read More
Given two strings A and B, the task is to find the smallest substring of A having B as a subsequence. Examples: Input: A =… Read More
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… Read More
Given string str, the task is to rearrange the given string to obtain the longest palindromic substring. Examples: Input: str = “geeksforgeeks”Output: eegksfskgeeorExplanation: eegksfskgee is… Read More