Can anyone tell time complexity my code?


#1

int Solution::diffPossible(vector &A, int B) {
int i = 0 ,j =(A.size()-1)/2;

while(i<=j && j<A.size()){
    if(A[j] - A[i] == B && i!=j) return 1;
    else if((A[j]-A[i]) > B)i++;
    
    else j++;
}

return 0;

}