Given a String ph[], the task is to find the absolute difference of consecutive elements and insert the result in between the consecutive elements. By… Read More

# Tag Archives: two-pointer-algorithm

Given an array arr[ ] of size N, the task is to find the rank of the remaining element in an array after performing the… Read More

Given N and M number of points on the straight line, denoting the positions of the customers and vendors respectively. Each vendor provides service to… Read More

Given an array arr[] of size N and an integer P (P < N), the task is to find the original array from the array… Read More

Given two sorted arrays of distinct elements, we need to print those elements from both arrays that are not common. The output should be printed… Read More

Given an array of integers, you have to find three numbers such that the sum of two elements equals the third element.Examples: Input: {5, 32,… Read More

Two pointers is really an easy and effective technique which is typically used for searching pairs in a sorted array.Given a sorted array A (sorted… Read More