Simple map approach | efficient!
\n# Approach\ncreated a ordered map for taking the frequency and then pushed back the elements in vector whose increment and decrement did not exist and whose f
\n# Approach\ncreated a ordered map for taking the frequency and then pushed back the elements in vector whose increment and decrement did not exist and whose frequency is 1.\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        map<int,int> mp;\n        vector<int> lone;\n        for(int i=0;i<nums.size();i++)\n            mp[nums[i]]++;\n        for(auto it:mp)\n        {\n            if(mp.count(it.first-1)==0&&mp.count(it.first+1)==0&&it.second==1)\n            lone.push_back(it.first);\n        }\n        return lone;\n        \n        \n    }\n};\n```
['C++']