#C13710. Two-Sum Existence
Two-Sum Existence
Two-Sum Existence
Given a list of integers and a target value, determine whether there exist two distinct integers in the list that add up to the target. The input consists of an integer n indicating the number of elements, followed by n space-separated integers and finally a target integer. You must print True
if such a pair exists, and False
otherwise.
For example, if the input is:4
2 7 11 15
9
Since 2 + 7 = 9, the answer is True
.
inputFormat
The input is read from standard input and has the following format:
The first line contains an integer n, the number of elements in the array. The second line contains n space-separated integers representing the array elements. The third line contains a single integer which is the target sum.
outputFormat
Print either 'True' or 'False' (without quotes) to standard output, indicating whether there exist two distinct integers in the array whose sum equals the target.## sample
4
2 7 11 15
9
True
</p>