# Tag Archives: two-pointer-algorithm

Given an array of integers, you have to find three numbers such that the sum of two elements equals the third element. Examples:  Input :… Read More
Write a program to reverse the given string while preserving the position of spaces. Examples:  Input : "abc de" Output : edc ba Input :… Read More
Given an array of distinct elements. The task is to find triplets in the array whose sum is zero. Examples :  Input: arr[] = {0,… Read More
Given two sorted arrays and a number x, find the pair whose sum is closest to x and the pair has an element from each… Read More
Given a sorted array and a number x, find a pair in an array whose sum is closest to x. Examples: Input: arr[] = {10,… Read More
Given an array of integers, find all combination of four elements in the array whose sum is equal to a given value X. For example, if… Read More
Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is… Read More