```
class Solution:
def findPairs(self, nums, k):
if k<0:return 0
if k==0:return len(set(list(filter(lambda x:nums.count(x)>1,nums))))
return len(set(sorted(nums)) & set(map(lambda x:x+k,nums)))
# you can check the blog http://yangyiqing.cn/2017/12/13/leetcode/
```