(RankList for this Question)
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
Constraints
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
Input:
8
3 5 -4 8 11 1 -1 6
10
Output:
-1 11
Explanation:
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