Python easy solution using sets


#1

class Solution:
# @param A : list of integers
# @param B : integer
# @return an integer
def diffPossible(self, A, B):
s=set()
for i in A:
if(i+B in s or i-B in s):
return 1
else:
s.add(i)
return 0