#K65967. Pair with Given Difference

    ID: 32315 Type: Default 1000ms 256MiB

Pair with Given Difference

Pair with Given Difference

Given an array of integers and an integer target, determine whether there exist two distinct indices i and j such that either

$$a_i - a_j = \text{target}$$ or $$a_j - a_i = \text{target}$$

Please note that if target = 0, the condition is satisfied only when the same integer appears at least twice in the array.

Example:

Input: [1, 5, 3, 4], target = 2
Output: True

inputFormat

The input consists of three lines:

  1. The first line contains an integer n, which is the number of elements in the array.
  2. The second line contains n space-separated integers representing the array.
  3. The third line contains an integer target.

outputFormat

Output a single line containing either True or False depending on whether such a pair exists.

## sample
4
1 5 3 4
2
True

</p>