# Tag Archives: substring (adsbygoogle = window.adsbygoogle || []).push({});

## Queries to find the first non-repeating character in the sub-string of a string

Given a string str, the task is to answer Q queries where every query consists of two integers L and R and we have to… Read More »

## Count number of distinct substrings of a given length

Given a string S of length N consisting of lower-case English albhabets and an integer ‘l’, find the number of distinct sub-strings of length ‘l’… Read More »

## Count of three non-overlapping sub-strings which on concatenation forms a palindrome

Given a string str, the task is to count the number of ways a palindromic sub-string could be formed by concatenation of three sub-strings x,… Read More »

## Queries to check if string B exists as substring in string A

Given two strings A, B and some queries consisting of an integer i, the task is to check whether the sub-string of A starting from… Read More »

## Rearrange given string to maximize the occurrence of string t

Given two binary strings s and t. The task is to rearrange the string s in such a way that the occurrence of string t… Read More »

## Find max length odd parity substring

Given a binary string str, the task is to find the maximum length of the sub-string of str that has odd parity. A binary string… Read More »

## Queries to find the last non-repeating character in the sub-string of a given string

Given a string str, the task is to answer Q queries where every query consists of two integers L and R and we have to… Read More »

## Check if a string contains two non overlapping sub-strings “geek” and “keeg”

Given a string str, the task is to check whether the string contains two non-overlapping sub-strings s1 = “geek” and s2 = “keeg” such that… 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. Examples: Input: str = “abaaa”… Read More »

## Minimum number of sub-strings of a string such that all are power of 5

Given a binary string str. The task is to find the smallest positive integer C such that the binary string can be cut into C… Read More »

## Check whether given string can be generated after concatenating given strings

Given three strings str, A and B. The task is to check whether str = A + B or str = B + A where… Read More »

## Length of the longest substring that do not contain any palindrome

Given a string of lowercase, find the length of the longest substring that does not contain any palindrome as a substring. Examples: Input : str… Read More »

## Calculate score for the given binary string

Given a binary string str. For n-contiguous 1s the score is updated as score = score + n2 and for n-contiguous 0s, the score is… Read More »

## Queries to answer the X-th smallest sub-string lexicographically

Given a string str and Q queries. Every query consists of a number X, the task is to print the Xth lexicographically smallest sub-string of… Read More »

## Check if string can be made lexicographically smaller by reversing any substring

Given a string S, the task is to check if we can make the string lexicographically smaller by reversing any sub-string of the given string.… Read More »