Pair Sums
Practice
4 (107 votes)
Easy
Problem
81% Success 47528 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You have been given an integer array A and a number K. Now, you need to find out whether any two different elements of the array A sum to the number K. Two elements are considered to be different if they lie at different positions in the array. If there exists such a pair of numbers, print "YES" (without quotes), else print "NO" without quotes.

Input Format:

The first line consists of two integers N, denoting the size of array A and K. The next line consists of N space separated integers denoting the elements of the array A.

Output Format:

Print the required answer on a single line.

Constraints:

\( 1 \le N \le 10^6 \)

\( 1 \le K \le 2*10^6 \)

\( 1 \le A[i] \le 10^6 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
49 votes
Tags:
Ad-HocApprovedEasyOpen
Points:20
16 votes
Tags:
Accessing MapsData StructuresEasyHash TablesImplementationPriority queueString Manipulation
Points:20
26 votes
Tags:
AlgorithmsEasy