Given two integers L and R and an array arr[] consisting of N positive integers( 1-based indexing ) such that the frequency of ith element… Read More

# Tag Archives: prefix

Given an integer K and two arrays A[] and B[] consisting of N and M integers, the task is to maximize the number of elements… Read More

Given two binary strings A and B of length N, the task is to convert the string from A to string B by repeatedly flipping… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to find the maximum sum of pairs of elements that… Read More

Given an array arr[] consisting of N positive integers and an array Query[][2] consisting of Q queries of the form {L, R}, the task is… Read More

Given a string S consisting of N characters, the task is to find the length of all prefixes of the given string S that are… Read More

Given three strings S, S1, and S2, the task is to check if the number of substrings that start and end with S1 and S2… Read More

Given an array arr[] consisting of N positive integers and a 2D array Q[][] consisting of queries of the type {i, val}, the task for… Read More

Given a string S of length N consisting only of characters ‘a’, ‘b’, and ‘c’, the task is to minimize the length of the given… Read More

Given an array arr[] consisting of N positive integers, the task is to find the permutation of first N natural numbers such that the given… Read More

Given an array arr[] of size N, the task is to rearrange the array elements such that the sum of MEX of all prefix arrays… Read More

Given an array arr[] consisting of N integers, the task is for each array element, say arr[i], is to find the number of array elements… Read More

Given an array arr[] consisting of N positive integers and a 2D array queries[][] of the type {a, K, X} such that if the value… Read More

Given an array arr[] consisting of N positive integers, the task is to replace each array element with the nearest power of GCD of all… Read More