C++ easy solution | Hashing
First take count of all elements using hashing and then check for adjacent numbers and check if it appears only once.\n\nclass Solution {\npublic:\n    vector<i
First take count of all elements using hashing and then check for adjacent numbers and check if it appears only once.\n```\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        vector<int> ans;\n        unordered_map<int, int> dict;\n        for (int i = 0; i < nums.size(); ++i) {\n            if (dict.find(nums[i]) != dict.end()) {\n                dict[nums[i]]++;\n            }\n            else {\n                dict[nums[i]] = 1;\n            }\n        } \n        for (auto [a, b] : dict) {\n            if (dict.find(a+1) == dict.end() && dict.find(a-1) == dict.end() && b == 1) //check for adjacent numbers using a+1 and a-1 and check if it appears only once\n                ans.push_back(a);\n        }\n        return ans;\n    }\n};\n```
[]