Python solution
\nclass Solution(object):\n    def findPairs(self, nums, k):\n        """\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        """
```\nclass Solution(object):\n    def findPairs(self, nums, k):\n        """\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        """\n        if k < 0:\n            return 0\n        res = 0\n        counter = collections.Counter(nums)\n        for key in counter:\n            if k != 0:\n                if key - k in counter:\n                    res += 1\n            else:\n                if counter[key] > 1:\n                    res += 1\n        return res\n```
[]