Given an array arr[] consisting of N integers and two positive integers K and M, the task is to find the number of subarrays of… Read More

# 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 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[] 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 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