#C1856. Pair with Specific Difference
Pair with Specific Difference
Pair with Specific Difference
Given an array of integers and an integer K, determine whether there exists a pair of distinct indices i and j such that:
\( \text{arr}[i] - \text{arr}[j] = K \)
Note that the indices must be distinct even if the elements have the same value. Output True if such a pair exists, and False otherwise.
inputFormat
The input is given in three lines:
- The first line contains an integer n, the number of elements in the array.
- The second line contains n space-separated integers representing the array elements.
- The third line contains the integer K.
outputFormat
Output a single line with True if there exists a pair of distinct indices satisfying the condition, otherwise output False.
## sample5
4 7 3 2 6
4
True