#K1211. Pair Sum Existence
Pair Sum Existence
Pair Sum Existence
Given an array of integers and a target value (x), determine whether there exist two distinct elements in the array whose sum is exactly (x). This problem tests your ability to efficiently find pairs and handle edge cases such as duplicate elements, negative numbers, and empty arrays.
For example, if the input array is [2, 7, 11, 15] and (x = 9), then the answer is True because (2 + 7 = 9).
inputFormat
Input is read from standard input (stdin).
The first line contains two integers (n) and (x) separated by a space, where (n) is the number of elements in the array and (x) is the target sum. The second line contains (n) space-separated integers representing the array.
outputFormat
Output to standard output (stdout) a single line containing either True
if there exists a pair of distinct elements whose sum is (x), or False
if no such pair exists.## sample
4 9
2 7 11 15
True