Skip to content

Tag Archives: substring

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
Given a string S, the task is to check if we can make the string lexicographically smaller by reversing any substring of the given string. … Read More
Given the string str, a character c, and an integer k > 0. The task is to find the number of sub-strings that contain the… Read More
Given a string str and a character X. The task is to find the total number of sub-strings that contain the character X at least… Read More
Given an integer N, the task is to find the length of the longest substring containing only 4’s from the first N characters of the… Read More
Given a string str consisting of lowercase English letters and an integer K. The task is to find the minimum length of the sub-string whose… Read More
Given a string str and an integer N, the task is to find the number of possible sub-strings of length N.Examples:   Input: str = “geeksforgeeks”,… Read More
Given a string str and a character c. The task is to find the number of sub-strings that do not consist of the character c. Examples:  … Read More
Given a string S. The task is to count the non-overlapping pairs of palindromic sub-strings S1 and S2 such that the strings should be S1[L1…R1]… Read More
Given a string str, the task is to find the length of the longest sub-string which does not have any pair of consecutive same characters. Examples:  … Read More
Given a string str, the task is to find the count of all the sub-strings of length four whose characters can be rearranged to form… Read More
Given an integer N, the task is to generate all possible binary strings of length N which contain “01” as the sub-string exactly twice. Examples: … Read More
Given a string str consisting only of the characters ‘a’, ‘b’ and ‘c’, find the number of sub-strings that do not contain all the three… Read More
Given a string S and a range [L, R]. The task is to find the number of ways in which the sub-string in the range… Read More
Every state is represented by string of length 2. For example DL is used for Delhi, HP for Himachal Pradesh, UP for Uttar Pradesh, PB… Read More