Python 3 (60ms) | O(n) Counter Hashmap Solution | Easy to Understand
\nclass Solution:\n    def findPairs(self, nums: List[int], k: int) -> int:\n        count = Counter(nums)\n        if k > 0:\n            return sum([i + k in 
```\nclass Solution:\n    def findPairs(self, nums: List[int], k: int) -> int:\n        count = Counter(nums)\n        if k > 0:\n            return sum([i + k in count for i in count])\n        else:\n            return sum([count[i] > 1 for i in count])\n```
['Python', 'Python3']