SDE Path

Does a Pair Sum to Target

Easy

Does a Pair Sum to Target

Decide whether two elements add up to a target (two-sum).

Input format

The first line has N. The second line has N integers. The third line has the target sum.

Output format

Print true if two elements at different positions add up to the target, otherwise false.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
5
2 7 11 15 1
9
Expected output
true
Example 2
Input
4
1 2 3 4
100
Expected output
false