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: import java.io.*;
import java.util.*;


class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        try{
        int n = sc.nextInt();
        int arr[] = new int[n];
        HashMap<Integer, Integer> map =new HashMap<>();
        for(int i=0; i<n; i++){

            arr[i]=sc.nextInt();
            map.put(arr[i], 1);
    }
    int target = sc.nextInt();
    boolean found = false;
    for(int i =0; i<n; i++){
        if(map.containsKey(arr[i]+target)){
            found=true;
            break;
        }
    }
    if(found)
    System.out.println("Yes");
    else
    System.out.println("No");
        }
    catch(Exception e){
        System.out.println("No");

    }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?