Find All Lonely Numbers in the Array unordered_map C++ Solution
\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        \n        vector<int> ans;\n        unordered_map<int,int> mp;\n        \n
```\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        \n        vector<int> ans;\n        unordered_map<int,int> mp;\n        \n        for(int i=0;i<nums.size();i++)\n        {\n            mp[nums[i]]++; //storing in map with frequency\n        }\n        \n        for(auto it:mp)\n        {\n            if(it.second==1)  //frequency must be 1\n            {\n                int x=it.first-1;  \n                int y=it.first+1;\n                \n                if(mp.find(x)==mp.end() && mp.find(y)==mp.end())\n                {\n               \n                    ans.push_back(it.first);\n                }\n            }\n        }\n        \n        return ans;\n        \n    }\n};\n```
['C']