# Category Archives: Pattern Searching

Given two strings, text and pattern, of size N and M (N > M)respectively, the task is to print all occurrences of pattern in text. … Read More
Given an integer N, the task is to construct and print an Array, such that: The size of array is N The elements in array… Read More
Given an array arr[] of size N, and an integer K, the task is to maximize the first element of the array in K operations… Read More
Given an Array input[] consisting only of 1s initially and an array target[] of size N, the task is to check if the array input[]… Read More
Given an integer N, the task is to construct the longest possible array A[], such that the following conditions hold: A = N. No two… Read More
Given an array arr[] of N integers, the task is to sort the array by replacing any element at index i (arr[i]) with arr[j] –… Read More
Given integers N and K, the task is to construct an array arr[] of size N using numbers in the range [1, N] such that… Read More
Given the root of a binary tree in which all nodes has values either 0 or 1, the task is to check if the level-wise… Read More
Consider an integer sequence S, which is initially empty (i.e. S = {}). Also given are Q queries, each of which is one of the… Read More
Given an array arr[] of size N (multiple of 8) where the values in the array will be in the range [a, (a+8*N) -1] (a… Read More
Given an integer N, the task is to generate a permutation from 1 to N such that the bitwise XOR of differences between adjacent elements… Read More
Given an array A[] of N integers. Consider an integer num such that num occurs in the array A[] and all the positions of num,… Read More
Given an integer N (which is always a power of 2) denoting the length of an array which contains integers in range [0, N-1] exactly… Read More
Given an integer N, the task is to construct a permutation from 1 to N where no adjacent elements have difference as 1. If there… Read More
Given a range of number [L, R], the task is to find all numbers X in the given range such that X = sum of… Read More