#K7401. Find Pair with Target Sum
Find Pair with Target Sum
Find Pair with Target Sum
You are given an array of integers and a target integer. The task is to determine whether there exist two distinct elements in the array whose sum is equal to the target. This includes considering negative numbers as well.
Note: Read the input from stdin
and output the result to stdout
. If such a pair is found, output True
; otherwise, output False
.
inputFormat
The first line contains an integer n representing the number of elements in the array. The second line contains n space-separated integers. The third line contains a single integer which is the target sum.
outputFormat
Print True
if there exists a pair of distinct elements in the array that sum up to the target value. Otherwise, print False
.
4
1 2 3 9
8
False