[🔥🔥][JAVA][SIMPLE][EASY][SET][NO SORT]☑️
Simplified  Clean Coded Solution !\uD83D\uDE00\n\nclass Solution {\n    public int findPairs(int[] nums, int k) {\n        int pairs = 0, n = nums.length;\n    
Simplified  Clean Coded Solution !\uD83D\uDE00\n```\nclass Solution {\n    public int findPairs(int[] nums, int k) {\n        int pairs = 0, n = nums.length;\n        \n        HashSet<Integer> set = new HashSet<>();\n        HashSet<Integer> repeatedElements = new HashSet<>();\n        \n        for(int ele : nums){\n            if(set.contains(ele)) repeatedElements.add(ele);\n            set.add(ele);\n        }\n        \n        // SPECIAL CASE [K == 0]\n        if(k == 0) return repeatedElements.size();\n        \n        // Traversing the SET not the array.\n        for(int elementInSet : set)\n            if(set.contains(elementInSet + k)) pairs++;\n       \n        return pairs;\n    }\n}\n```
['Ordered Set', 'Java']