✅[C++] Easy code with inline Explanation O(nlogn)
\nvector<int> findLonely(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        vector<int>vec;\n        for(int i=0;
```\nvector<int> findLonely(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        vector<int>vec;\n        for(int i=0;i<nums.size();i++){\n            while(i+1<n && nums[i]==nums[i+1])i++;     //skip same value element\n            int flag1=1,flag2=1;                       //set flags \n            \n            if(i!=0 && (nums[i-1]==nums[i] || nums[i-1]==nums[i]-1)) flag1=0; \n            if(i!=n-1 &&  nums[i]+1==nums[i+1]) flag2=0; //reset flag if condition violet\n            if(flag1 && flag2) vec.push_back(nums[i]);  //lonely element if both condition followed\n        }\n        return vec;\n    }\n```\n\nUpvote if you appreciate :)
['C', 'C++']