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