#C14734. Two Number Sum
Two Number Sum
Two Number Sum
You are given an array of distinct integers and a target sum \(T\). Your task is to find any two numbers in the array that add up to \(T\). If such a pair exists, output the two numbers (order does not matter). Otherwise, output an empty array []
.
Example:
Input: 8 3 5 -4 8 11 1 -1 6 10</p>Output: 11 -1
Note: The formula for the target calculation is \(a + b = T\), where \(a\) and \(b\) are two distinct numbers from the array.
inputFormat
The input is given from standard input (stdin) and has three parts:
- An integer (n) representing the number of elements in the array.
- A line with (n) space-separated integers representing the array elements.
- An integer representing the target sum (T).
outputFormat
Output to standard output (stdout). If a valid pair is found, print the two integers separated by a space. Otherwise, print an empty array as '[]'.## sample
8
3 5 -4 8 11 1 -1 6
10
11 -1