Python faster than 93%
\nclass Solution:\n    def findPairs(self, a: List[int], K: int) -> int:\n        s = set(a)\n        if K == 0: return sum(1 for x in s if a.count(x) > 1)\n   
```\nclass Solution:\n    def findPairs(self, a: List[int], K: int) -> int:\n        s = set(a)\n        if K == 0: return sum(1 for x in s if a.count(x) > 1)\n        return sum(1 for x in s if x + K in s)\n```
['Python']