intSolution::diffPossible(vector<int> &A, int B){ int l = 0, r = 1, n = A.size(); B = abs(B); while(r < n) { while(r < n and A[l] + B > A[r]) r++; if(l == r) r++; if(r >= n) returnfalse; if(A[l] + B == A[r] and l != r) returntrue; while(l < r and A[l] + B < A[r]) l++; } returnfalse; }