Skip to content

Tag Archives: substring

Given a string str and an integer K, the task is to check whether the given string is K-periodic. A string is k-periodic if the… Read More
Given a string S and a number K. The task is to find the minimum length substring having exactly K distinct characters. Note: The string S… Read More
Given 3 strings S, A and B. The task is to replace every sub-string of S equal to A with B and every sub-string of… Read More
Given two strings a and b, the task is to count the number of common divisors of both the strings. A string s is a… Read More
Given a string str and an integer k. The task is to count the occurrences of sub-strings of length k that consist of the same… Read More
Given a integer k and a sting str, the task is to count the number of distinct sub-strings such that each sub-string does not contain… Read More
Given a string S containing lowercase latin letters. A character c is called K-amazing if every substring of S with length atleast K contains this… Read More
The classical problem that can be handled quite easily by Python and has been also dealt with many times is finding if a string is… Read More
Given string str, the task is to print the pattern given in the examples below: Examples:   Input: str = “geeks” Output: geeks *kee* **e** The reverse of “geeks” is “skeeg” Replace… Read More
Given a string, print all the possible substrings which are also the prefix of the given string. Examples: Input : ababc Output : a, ab,… Read More
Given a string str, the task is to count all possible sub-strings of the given string that are prefix of the same string. Examples:  Input:… Read More
Given two strings S1 and S2, the task is to count the number of sub-strings of S1 that are anagrams of any sub-string of S2.Examples:  … Read More
Given an integer K and a string str of lowercase English characters, the task is to find a string s such that when s is… Read More
Given a string of length consisting of lowercase alphabets. The task is to find the number of such substrings whose characters occur in alphabetical order. Minimum… Read More
Given a string str consisting of lowercase English alphabets, the task is to find the total number of palindromic sub-strings present in the sorted form… Read More