✅✅✅C++ | easy to grasp | beats 100%🔥🔥🔥
\n# Code\n\nclass Solution {\n    public List<Integer> findLonely(int[] nums) {\n        Arrays.sort(nums);\n        ArrayList<Integer> list = new ArrayList<>()
\n# Code\n```\nclass Solution {\n    public List<Integer> findLonely(int[] nums) {\n        Arrays.sort(nums);\n        ArrayList<Integer> list = new ArrayList<>();\n        for (int i = 0; i < nums.length; i++) {\n            boolean isLonely = true;\n            if (i>0 && (nums[i]==nums[i-1] || nums[i]==nums[i-1]+1)){\n                isLonely = false;\n            }\n            if (i<nums.length-1 && (nums[i]==nums[i+1] || nums[i]==nums[i+1]-1)){\n                isLonely = false;\n            }\n            if (isLonely) {\n                list.add(nums[i]);\n            }\n        }\n        return list;\n    }\n}\n\n```
['Array', 'Hash Table', 'Counting', 'C++', 'Java']