# Tag Archives: two-pointer-algorithm

There is a one-dimensional garden of length N. In each position of the N length garden, a fountain has been installed. Given an array a[]suchâ€¦ Read More
Given two arrays coins[] and salaries[] where coins[i] represents the value of ith coin and salaries[j] represents the minimum value of the coin that jthâ€¦ Read More
Given an array arr[] of N positive integers, the task is to find the subarray having maximum sum among all subarrays having unique elements andâ€¦ Read More
Given an array arr[] of size N, the task is to split the entire array into a minimum number of subarrays such that for eachâ€¦ Read More
Given an array arr[] consisting of N positive integers. The task is to find the length of the longest subarray of this array that containsâ€¦ Read More
Recommended Solve DSA problems on GfG Practice. Solve Problems My Personal Notes arrow_drop_up Save
Given an array arr[] of length N, the task is to find the longest subarray for each array element arr[i], which contains arr[i] as theâ€¦ Read More
Given an array arr[] consisting of non-negative integers, the task is to find the number of ways to split the array into three non-empty contiguousâ€¦ Read More
Given an array arr[], the task is to check if it is possible to rearrange the array in such a way that every even index(1-basedâ€¦ Read More
Given a binary string S, the task is to find the minimum number of swaps required to be performed to maximize the value represented byâ€¦ Read More
Given an array A[] consisting of N integers, the task is to find the maximum possible value of K, such that K * |i –â€¦ Read More
Given two integers N and K, the task is to find the total count of N-digit number such that the sum of every K consecutiveâ€¦ Read More
Given an array arr[] and an integer X, the task is to print the longest subarray such that the sum of its elements isn’t divisibleâ€¦ Read More
Given an array A[ ] consisting of N positive integers, the task is to find the number of triplets A[i], A[j] & A[k] in theâ€¦ Read More
Given an array arr[] of size N, consisting of positive and negative integers, the task is to find the longest alternating subsequence(i.e. the sign ofâ€¦ Read More