TIME 100% & SPACE 100% BEATS|| SORTING || C++ || SIMPLE
\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        if(nums.size()<=1)return nums;\n        sort(nums.begin(),nums.end());\n  
```\nclass Solution {\npublic:\n    vector<int> findLonely(vector<int>& nums) {\n        if(nums.size()<=1)return nums;\n        sort(nums.begin(),nums.end());\n        vector<int> ans;\n        int n = nums.size();\n        for(int i = 0; i < n; i++){\n            if(i && i<n-1){\n                if(nums[i]-nums[i-1]>1 && nums[i+1]-nums[i]>1){\n                    ans.push_back(nums[i]);\n                }\n            }else if(i){\n                if((nums[i]-nums[i-1])>1){\n                    ans.push_back(nums[i]);\n                }\n            }else{\n                if((nums[i+1]-nums[i])>1){\n                    ans.push_back(nums[i]);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'Sorting', 'C++']