For this Question: Given a one-dimensional sorted array A containing N integers.

You are also given an integer target, find if there exists a pair of elements in the array whose difference is equal to the target.
Approach this problem in O(n).The first line contains a single integer N.
The second line contains N space- separated integer A[i].
The third line contains an integer target.

Constraints
1<=N<=10^5
0<=A[i]<=10^9
0<=target<=10^9Print Yes if pair with given difference exists in our array otherwise print No.Sample Input 1:
5
1 2 7 9 11
5

Sample Output 1:
Yes


Sample Input 2:
5
1 1 8 8 25
0

Sample Output 2:
Yes, I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;
bool check(vector<int> A,int target,int n) {
    int i=0,j=1,x=0;
    while(i<=n && j<=n)
    {
        x=A[j]-A[i];
        if(x==target && i!=j)return 1;
        else if(x<target)j++;
        else i++;
    }
    return 0;
}
int main() {
	int n,target;
	cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++)cin>>arr[i];
	cin>>target;
    cout<<(check(arr,target,n)==1 ? "Yes" : "No");
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?