# Tag Archives: two-pointer-algorithm

Given a string S which consists of only lowercase English alphabets, the task is to remove the first repeating character, reverse it, and repeat until… Read More
Given an array, arr[] and integer X. Find all the possible triplets from an arr[]  whose sum is either equal to less than X. Example:… Read More
Given an array a[] of 2*N integers, The task is to make the array a[] of size N i.e, reducing it to half size such… Read More
Given an array of positive elements arr[] of length N, the task is to count all the subarrays such that the product of the subarray… Read More
Given a string S of size N and a positive integer K. The given string only consists of the first K English lowercase alphabets. The… Read More
Given an array arr[] of size N and a non-negative integer K, the task is to find the length of the longest subsequence such that… Read More
Given two arrays A[] and B[] of size N each, the task is to find the number of elements in array B[] that occur before… Read More
Given an array arr[] of N Positive integers, the task is to find the largest prefix sum which is also the suffix sum and prefix… Read More
Given an array arr[] of size N, the task is to print the lexicographically next greater permutation of the given array. If there does not… Read More
Given an integer array arr[] of size N that is sorted in increasing order and an integer K, Return an array with power of K… Read More
Given a binary array a[] or size N and an integer K, the task is to find the longest subarray consisting of only 1s or… Read More
Given an array arr[] of size N, the task is to find the minimum difference between the maximum and the minimum subarray sum when the… Read More
Given an integer array arr of size N[], the task is to find the longest equilibrium subarray i.e. a subarray such that the prefix sum… Read More
Given a stack of M elements and a queue of N elements in sorted order. The task is to find out the common elements of… Read More
Given a string S of size N consisting of the characters 0, 1 and 2, the task is to find the length of the smallest… Read More