0.1 Two Number Sum
(RankList for this Question)
Score: 10pts
Time Limit: 2.00 sec
Write a function that takes in an integer denoting the number of elements in an array, a non-empty distinct integer array, and a target sum. If two numbers in an array sum up to the target sum the function should print both the numbers in increasing order and space-separated. If there are no two numbers whose sum is equal to the target sum, print -1.
The two numbers can’t be the same integer; they have to be distinct integers.
You can assume there will be at most one pair of numbers summing up to the target sum

2≤ N ≤ 500

Input Format
N- number of integers in the array
Array of distinct integers
Target Sum

Output Format
Pair of numbers adding to the target sum

Example 1
3 5 -4 8 11 1 -1 6

-1 11

11 and -1 add up to the target sum 10 and the output has to be in increasing order thus the output is -1 11

Log In to solve the Question