## Count pairs from two sorted matrices with given sum

Given two sorted matrices mat1 and mat2 of size n x n of distinct elements. Given a value x. The problem is to count all… Read More »

## Two Pointers Technique

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… Read More »

## Find a triplet such that sum of two equals to third element

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

## Find all triplets with zero sum

Given an array of distinct elements. The task is to find triplets in array whose sum is zero. Examples : Input : arr[] = {0,… Read More »

## Find the closest pair from two sorted arrays

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 the pair in array whose sum is closest to x

Given a sorted array and a number x, find a pair in array whose sum is closest to x. Examples: Input: arr[] = {10, 22,… Read More »

## Find four elements that sum to a given value | Set 1 (n^3 solution)

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,… Read More »

## Find a triplet that sum to a given value

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 »