## Longest prefix which is also suffix

Given a string s, find length of the longest prefix which is also suffix. The prefix and suffix should not overlap. Examples: Input : aabcdaabc… Read More »

Given a string s, find length of the longest prefix which is also suffix. The prefix and suffix should not overlap. Examples: Input : aabcdaabc… Read More »

Given a numeric string (length <= 32), split it into two or more integers( if possible), such that 1) Difference between current and previous number… Read More »

Given a 2-Dimensional character array and a string, we need to find the given string in 2-dimensional character array such that individual characters can be… Read More »

You are given two string str1 and str2 of same length. In a single shift you can rotate one string (str2) by 1 element such… Read More »

Given a input string and a substring. Find the frequency of occurrences of substring in given string. Examples: Input : man (pattern) dhimanman (string) Output… Read More »

Given an alphanumeric string, find the number of times a pattern 1(0+)1 occurs in the given string. Here, (0+) signifies the presence of non empty… Read More »

In Set 1, we have discussed general approach for counting the patterns of the form 1(0+)1 where (0+) represents any non-empty consecutive sequence of 0’s.In… Read More »

A string contains patterns of the form 1(0+)1 where (0+) represents any non-empty consecutive sequence of 0’s. Count all such patterns. The patterns are allowed… Read More »

We have already discussed Bad character heuristic variation of Boyer Moore algorithm. In this article we will discuss Good Suffix heuristic for pattern searching. Just… Read More »

is_permutations() is used to check if two containers like string and vector are permutation of each other. It accepts three parameters, the first two parameters… Read More »

Given two string, in which one is pattern (Pattern) and other is searching expression. Searching expression contains ‘#’. The # works in following way: A… Read More »

Given two strings s and t. The task is to find maximum length of some prefix of the string S which occur in string t… Read More »

Given a string str that may contain one more occurrences of “AB”. Replace all occurrences of “AB” with “C” in str. Examples: Input : str… Read More »

Given a text and a wildcard pattern, implement wildcard pattern matching algorithm that finds if wildcard pattern is matched with text. The matching should cover… Read More »

Given a 2D grid of characters and a word, find all occurrences of given word in grid. A word can be matched in all 8… Read More »