Python Elegant & Short | Hash Map | Counter
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def findLonely(self, nums: List[int]) -> List[int]:\n        cou
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution:\n    def findLonely(self, nums: List[int]) -> List[int]:\n        count = Counter(nums)\n        return [num for num, cnt in count.items() if cnt == 1 and count[num - 1] == count[num + 1] == 0]\n```
['Hash Table', 'Python', 'Python3']