public static boolean checkSumUsingHash(int[] A, int x) {	// Time complexity - O(n)
		if(A == null || A.length < 2)
			return false;
		int i, flag = 0;
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(i = 0; i < A.length; i++)
			map.put(A[i], i);
		for(i = 0; i < A.length; i++) {
			if(map.get(x - A[i]) != null && map.get(x - A[i]) != i) {
				System.out.println("Pair " + A[i] + ", " + A[map.get(x - A[i])] + " has sum " + x);
				flag = 1;
			}
		}	
		if(flag == 1)
			return true;
		return false;
	}