#C3292. Find Pair With Target Sum

    ID: 46703 Type: Default 1000ms 256MiB

Find Pair With Target Sum

Find Pair With Target Sum

Given an array of integers and an integer target, your task is to find a pair of numbers in the array whose sum is equal to the target. The order of the numbers does not matter. If such a pair exists, output the pair; otherwise, output an empty array represented as [] in the output.

You can assume that:

  • The number of elements in the array is between 0 and 105.
  • Each element in the array and the target can range between -109 and 109.

If multiple valid pairs exist, any one of them is acceptable.

inputFormat

The input is provided via standard input (stdin) in the following format:

n
arr[0] arr[1] ... arr[n-1]
target

Where n is the number of elements in the array, followed by n space-separated integers representing the array elements, and finally an integer target that represents the desired sum.

outputFormat

Output the pair of integers that add up to the target, separated by a space, if such a pair exists. If no such pair exists, output an empty array "[]". The output should be written to standard output (stdout).

## sample
4
2 7 11 15
9
2 7

</p>