#K42182. Pair Sum Problem
Pair Sum Problem
Pair Sum Problem
You are given an array of integers and a target integer K
. Your task is to determine if there exist two distinct elements a and b in the array such that their sum equals K
. In mathematical notation, you need to check if there exist two indices i
and j
(i \neq j
) with
$a + b = K$
If such a pair exists, print True
; otherwise, print False
.
inputFormat
The first line contains two integers n
and K
, where n
is the number of elements in the array and K
is the target sum.
The second line contains n
space-separated integers representing the elements of the array.
outputFormat
Output a single line containing either True
or False
(without quotes) depending on whether there exists a pair with sum equal to K
.
4 17
10 15 3 7
True