Skip to content

Category Archives: Pattern Searching

Given a string S of length L, where L is a perfect square, the task is to check if the given string satisfies the following… Read More
Given a string S and two positive integers X and Y, the task is to find the minimum number of operations required to obtain the… Read More
Given an array arr[] consisting of N integers and an array Q[][], where each row is a query of the form {L, R}. The task… Read More
Given an integer N, the task is to count all possible strings of length N consisting of vowels {a, e, i, o, u} that can… Read More
Given an integer N, the task is to count the number of pairs of prime numbers in the range [1, N] such that the difference… Read More
Given an array arr[] consisting of N integers. Two players, Player 1 and Player 2, play turn-by-turn in which one player can may either of… Read More
Given two integers X and Y, the task is to check if it is possible to reach (X, Y) from (1, 1) by the following… Read More
Given numerical string str consisting of N integers, the task is to find the sum of all possible resulting strings after removing non-empty substrings. Examples:… Read More
Given a string str of length N and a substring pattern of length M, the task is to find the frequency of occurrences of pattern… Read More
Given a binary string S of length N, the task is to find the minimum number of removal of adjacent similar characters required to empty… Read More
Given an array, arr[] of size N, the task is to count the number of unordered pairs such that Bitwise AND and Bitwise OR of… Read More
Given a matrix M[][] of dimensions N * M, the task is to find the minimum number of increments of matrix elements by 1 required… Read More
Given an integer N, the task is to reduce N to 1 by minimum number of operations involving multiplication by 2 and division by 10.… Read More
Given an integer N, the task is to check if there exists any permutation of the first N natural numbers [1, N] such that Bitwise… Read More
Given an array arr[] of N positive integers, the task is to find the sum of the product of elements of all the possible subarrays.… Read More