Two Sum
Easyjavapythonccppjavascript
Given an array and a target value, determine whether two different positions hold values that add up to the target.
Input Format
The first line contains two integers N and target. The second line contains N space-separated integers.
Output Format
Print 1 if such a pair exists, otherwise print 0.
Example 1
Input
4 9 2 7 11 15
Output
1
Explanation: 2 + 7 = 9.
- 2 <= N <= 100000
- -1000000000 <= A[i], target <= 1000000000