# Category Archives: Pattern Searching

Given two strings s1 and s2, check whether s2 is a rotation of s1. Examples:  Input : ABACD, CDABA Output : True Input : GEEKS, EKSGE… Read More
Given a series 0, 4, 18, 48, 100 . . .  and an integer N, the task is to find the N-th term of the… Read More
Given an array of integers arr[], find the subsequence with maximum sum whose elements are first decreasing, then increasing, or vice versa, The subsequence can… Read More
Juggler Sequence is a series of integer number in which the first term starts with a positive integer number a and the remaining terms are… Read More
Given a string str of N characters, the task is to calculate the count of valid unordered pairs of (i, j) such that the string… Read More
Given two positive integers N and K, the task is to construct a permutation of the first N natural numbers such that all possible absolute… Read More
Given three numbers R, G and B as the color code for Red, Green and Blue respectively as in the form of RGB color code.… Read More
Given an N x M matrix mat[][] where initially we are standing at the cell with index (i, j), the task is to find the… Read More
Given an array arr[], the task is to find the length of the longest alternating subarray.  A subarray {x1, x2, .. xn} is an alternating… Read More
Given an integer N, the task is to print the first N terms of the Fibonacci series in reverse order using Recursion. Examples: Input: N… Read More
Given a string str containing lowercase characters, the task is to find the minimum number of operations needed to make all the characters equal. In… Read More
Given an integer N, the task is to print a pattern of fish over 2N+1 rows. Example: Input: N=3Output:        *    … Read More
Given a string str, the task is to check whether the given string is an HTML Hex Color Code or not. Print Yes if it… Read More
Given a number N and an infinite 2D matrix, which is to be filled using the algorithm given below, the task is to find the… Read More
Given a binary string S of size N and an integer K, the task is to find the maximum length of consecutive 1s or 0s… Read More