O(1) space solution using binary search
Intuition\n    \n# Approach\n easy binary search\n \n# Complexity\n- Time complexity:O(nlogn+ n(logn+logn))\n Add your time complexity here, e.g. O(n) \n\n- Spa
# Intuition\n    \n# Approach\n easy binary search\n \n# Complexity\n- Time complexity:O(nlogn+ n(logn+logn))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- o(1);\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     sort(nums.begin(),nums.end());\n     vector<int>res;\nint i =0;\nwhile(i<nums.size()){\n    int j =i;\nwhile(i+1<nums.size()&&nums[i]==nums[i+1])i++;\nif(i!=j){i++;continue;}\nif(i==nums.size())break;\nint val = nums[i];\nint f1 = binary_search(nums.begin(),nums.end(),val-1);\nint f2 = binary_search(nums.begin(),nums.end(),val+1);\nif(!f1&&!f2)res.push_back(val);\ni++;\n}\n\n     return res;  \n    }\n};\n```
['C++']