# Category Archives: Pattern Searching

String matching algorithms have greatly influenced computer science and play an essential role in various real-world problems. It helps in performing time-efficient tasks in multiple… Read More
Given two strings str1 and str2 of size N consisting of only three characters A, B, and C, the task is to check whether the… Read More
Given an array A[] consisting of distinct elements, the task is to obtain the largest possible modulus value that remains after repeatedly replacing adjacent elements… Read More
Given a numeric string S, the task is to find the maximum length of a subsequence having its left rotation equal to its right rotation.… Read More
Given four positive numbers A, B, C, D, such that A and B are the first term and the common difference of first Arithmetic sequence… Read More
Given two integers N, M denoting N×M chessboard, the task is to count the number of ways a knight can reach (N, M) starting from… Read More
Given two strings str1 and str2, the task is to find the lexicographic smallest permutation of str1 that contains str2 as a substring. Note: Assume… Read More
Given an array arr[] and an odd integer N, the task is to check if N numbers can be selected from the array having even… Read More
Given a character matrix arr[][] of dimensions 3 * N, consisting of three characters {#, *, . }, the task is to find the vowels(A,… Read More
Given an array of N distinct integers. For each element the task is to find the count of subsequence from all the possible subsequence whose… Read More
Given two integers N and K, the task is to find the Nth Subset from the sequence of subsets generated from the powers of K… Read More
Given four integers N, M, A, B where N is the number of rows and M is the number of columns, the task is to… Read More
Given a 2D grid arr[][] with different characters, the task is to detect whether it contains a cycle or not. A sequence of characters or… Read More
Given a string S of length N and integer K, find the smallest length string which contains the string S as a sub string exactly… Read More
Given an array arr[] consisting of N elements, the task is to check if the given array can be sorted by picking only corner elements… Read More