Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x.
...

Share

Given an unsorted array and a number n, find if there exists a pair of elements in the array whose difference is n.
Examples:
Input: arr[] = {5, 20, 3, 2, 50, 80}, n...

Share

There can be some instances where you need to return multiple values (may be of different data types ) while solving a problem. One method to do the same is by using ...

Share

The pair container is a simple container defined in <utility> header consisting of two data elements or objects.
The first element is referenced as ‘fi...

Share

You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. A pair (c, d) can follow another pair (a, b) if b < c. ...

Share

Map in STL is used to hash key and value. We generally see map being used for standard data types. We can also use map for pairs.
For example consider a simple proble...

Share

We have discussed some of the cases of sorting vector of pairs in below set 1.
Sorting Vector of Pairs in C++ | Set 1 (Sort by first and second)
More cases are discus...

Share

What is Vector of Pairs?
A pair is a container which stores two values mapped to each other, and a vector containing multiple number of such pairs is called a vector ...

Share

The genKeyPair() method of java.security.KeyPairGenerator class is used to generate a key pair. If this KeyPairGenerator has not been initialized expli...

Share

A Pair is a Tuple from JavaTuples library that deals with 2 elements. Since this Pair is a generic class, it can hold any type of value in it.
Since Pair is a Tuple, ...

Share