Very easy C++ Solution in O(N) time


#1

int Solution::diffPossible(const vector &A, int B)
{
unordered_map<int,int> mp;

for(int x =0; x<A.size(); x++)
{
    if(mp.find(A[x]) == mp.end())
    {
        mp[B+A[x]]++;
        mp[A[x]-B]++;
    }
    
    else
    return 1;
}

return 0;

}