Unordered Map Solution C++


#1

int Solution::diffPossible(const vector &A, int B) {
unordered_map<int,int> m;
if(A.size() < 2)
return 0;

for(int i = i ; i < A.size() ; i++){
   if(m.find(A[i] + B) != m.end() || m.find(A[i] - B) != m.end())
        return 1;
    m[A[i]] = 1;
}

return 0;

}