JAVA || HASHMAP
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g.  \n\n- Space complexity: O(n)\n Add your space complexity here, e.g.  \n\n# Code\n\ncl
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g.  -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g.  -->\n\n# Code\n```\nclass Solution {\n    public List<Integer> findLonely(int[] nums) {\n        ArrayList<Integer> ans = new ArrayList<>();\n        HashMap<Integer, Integer> map = new HashMap<>();\n\n        for(int i : nums) {\n            map.put(i, map.getOrDefault(i, 0) + 1);\n        }\n\n        for(Integer k : map.keySet()) {\n            if(map.get(k) == 1) {\n                if(!map.containsKey(k - 1) && !map.containsKey(k + 1)) {\n                    ans.add(k);\n                }\n            }\n        }\n\n        return ans;\n        \n    }\n}\n```
['Java']