Beats 99% of Python3(hashmap, no libraries)
\nclass Solution:\n    def findPairs(self, nums: List[int], k: int) -> int:\n        d = {}\n        cnt = 0\n        for i in nums:\n            if i not in d:
```\nclass Solution:\n    def findPairs(self, nums: List[int], k: int) -> int:\n        d = {}\n        cnt = 0\n        for i in nums:\n            if i not in d:\n                d[i] = 1\n            else:\n                d[i] += 1\n        \n        if k == 0:\n            for i in d.values():\n                if i > 1:\n                    cnt += 1\n        else:\n            for i in d:\n                if k + i in d:\n                    cnt += 1\n            \n        return cnt\n```
['Python']