Easy C++ solution using mapping
\n Add your space complexity here, e.g. O(n) \n\n# Code\n\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        vector<int>res;\n
\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        vector<int>res;\n        unordered_map<int,int>m;\n        for(int i=0;i<nums.size();i++){\n            m[nums[i]]++;\n        }\n        for(int i=0;i<nums.size();i++){\n            if(m[nums[i]]==1){\n                if((m.find(nums[i]-1)==m.end()) &&(m.find(nums[i]+1)==m.end())){\n                    res.push_back(nums[i]);\n                }\n            }\n        }\n        return res;\n    }\n};\n```
['C++']