C++ O(n) one pass with unordered_map
```\nint findPairs(vector& nums, int k) {\n        unordered_map mp;\n        int ans = 0;\n        if(k < 0) return 0;\n        for(int num:nums){\n           
```\nint findPairs(vector<int>& nums, int k) {\n        unordered_map<int,int> mp;\n        int ans = 0;\n        if(k < 0) return 0;\n        for(int num:nums){\n            if(k == 0 && mp[num] == 1){\n                ans++;\n            }else if(k > 0 && mp[num] == 0){\n                ans += mp.count(num - k) + mp.count(num + k);\n            }\n            mp[num]++;\n        }\n        return ans;\n        \n    }
['C++']