Close
Topic list
Pair Sum
EASY
15 mins
Arrays
Topics (Covered in this problem)
Problem solved
Skill meter
Arrays
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Pair Sum

Contributed by
Ashwani
Easy
0/40
Avg time to solve 15 mins
Success Rate 90 %
Share

## Problem Statement

#### Note:

``````Each pair should be sorted i.e the first value should be less than or equals to the second value.

Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````5 5
1 2 3 4 5
``````
##### Sample Output 1:
``````1 4
2 3
``````
##### Explaination For Sample Output 1:
``````Here, 1 + 4 = 5
2 + 3 = 5
Hence the output will be, (1,4) , (2,3).
``````
##### Sample Input 2:
``````5 0
2 -3 3 3 -2
``````
##### Sample Output 2:
``````-3 3
-3 3
-2 2
``````
Auto
Console