#K14081. Difference Pair Checker
Difference Pair Checker
Difference Pair Checker
You are given an array of n integers and an integer k. Your task is to determine whether there exists a pair of distinct indices i and j such that:
$$A_i - A_j = k$$
If such a pair exists, output Yes, otherwise output No.
Note: The pair of indices must satisfy i ≠ j.
inputFormat
The first line contains two integers n and k, where n is the number of elements in the array and k is the target difference.
The second line contains n space-separated integers representing the array A.
outputFormat
Output a single line containing Yes if there exists a pair of indices i and j (i ≠ j) such that A[i] - A[j] = k. Otherwise, output No.
## sample5 2
1 3 5 7 9
Yes