Short Java Solution, but two HashSets
\npublic class Solution {\n    public int findPairs(int[] nums, int k) {\n        Arrays.sort(nums);\n        Set<Integer> seenNum = new HashSet<>();\n        S
```\npublic class Solution {\n    public int findPairs(int[] nums, int k) {\n        Arrays.sort(nums);\n        Set<Integer> seenNum = new HashSet<>();\n        Set<String> seenPair = new HashSet<>();\n        int result = 0;\n        \n        for (int i = 0; i < nums.length; i++) {\n            int prev = nums[i] - k;\n            if (seenNum.contains(prev) && !seenPair.contains(prev + "," + nums[i])) {\n                result++;\n                seenPair.add(prev + "," + nums[i]);\n            }\n            seenNum.add(nums[i]);\n        }\n        return result;\n    }\n}\n```
[]