C++ || Hashmap
\nclass Solution {\npublic:\n    int findPairs(vector<int>& nums, int k) {\n        \n        int n=nums.size();\n        unordered_map<int,int>mymap;\n        
```\nclass Solution {\npublic:\n    int findPairs(vector<int>& nums, int k) {\n        \n        int n=nums.size();\n        unordered_map<int,int>mymap;\n        int count=0;\n        \n        \n        for(int i=0;i<n;i++){\n            mymap[nums[i]]++;\n        }\n        \n        if(k==0){\n            for(auto x:mymap){\n                if(x.second>1){\n                    count++;\n                }\n            }\n             return count;\n        }\n    \n        for(auto x:mymap){\n            if(mymap.count(x.first-k)){\n                count++;\n            }\n        }\n        return count;\n    }\n};\n```
['C']