# Tag Archives: two-pointer-algorithm

Given a string S consisting of N characters, the task is to find the anagram of the given string S such that the characters at… Read More
Given an array arr[] and a positive integer K, the task is to find the maximum count of disjoint pairs (arr[i], arr[j]) such that arr[j]… Read More
Given an array arr[] of size N consisting of only the first M natural numbers, the task is to find the minimum length of the… Read More
Given an array arr[] consisting of N integers and a positive integer K, the task is to find the maximum count of Armstrong Numbers present… Read More
Given a sorted string S consisting of N lowercase characters, the task is to rearrange characters in the given string such that no two adjacent… Read More
Given an array arr[] of size N. The task is to maximize the count of subarrays that contain both the minimum and maximum elements of… Read More
Given an array arr[] consisting of N integers, the task is to find the permutation of array elements such that the sum of odd indices… Read More
Given two positive integers X and Y and an array arr[] consisting of N positive integers such that arr[i] represents the height of the ith… Read More
Given three numbers N, A, and X, the task is to construct the lexicographically smallest binary array of size N, containing A 0s and having… Read More
Given an array arr[] consisting of N integers, the task is to find the largest number K (> 0) such that both the values K… Read More
Given two sorted arrays, X[] of size N and Y[] of size M having unique values. The task is to count the total number of… Read More
Given an array arr[] consisting of N non-negative integers, the task is to find the minimum length of the subarray whose sum is maximum. Example:… Read More
Given an array arr[] consisting of N positive integers and an integer K, the task is to find the highest frequency of any array element… Read More
Given two arrays consisting of N distinct integers such that the array A[] and B[] are sorted in ascending and descending order respectively, the task… Read More
Given an array arr[] of size N consisting of 0, 1, 2, and 3 only, the task is to sort the given array in ascending… Read More