K-diff Pairs in an Array Solutions in PythonNumber 532Difficulty EasyAcceptance 31.6%Link LeetCodeOther languages GoSolutionsPython solution by haoel/leetcodedef findPairs(self, nums, k): if k > 0: return len(set(nums) & set(a + k for a in nums)) elif k == 0: return sum(v > 1 for v in collections.Counter(nums).values()) return 0def findPairs(self, nums, k): if k > 0: return len(set(nums) & set(a + k for a in nums)) elif k == 0: return sum(v > 1 for v in collections.Counter(nums).values()) return 0