Easy and Understandable approach
Approach\n Describe your approach to solving the problem. \n1. Create an empty HashMap to store the frequency of each number in the array. The keys of the HashM
# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Create an empty HashMap to store the frequency of each number in the array. The keys of the HashMap will represent the numbers, and the values will represent their frequencies.\n\n2. Iterate through the array and update the frequency of each number in the HashMap:\n\n3. For each number in the array, check if it already exists as a key in the HashMap.\na. If it does, increment its corresponding frequency value by 1.\nb. If it doesn\'t, add it as a new key to the HashMap with an initial frequency of 1.\n\n4. Iterate through the array again and identify the lonely numbers. \n5. For each number in the array, retrieve its frequency from the HashMap. If the frequency is 1, it means the number might be lonely. To find out if it\'s really lonely check for 2 more conditions.\n6. Check by incrementing the number by 1 or decrementing number by 1 to see if next or previous adjacent number is present or not. If present means it\'s not lonely else it\'s lonely. \n7. Add the lonely number to a result list.\n8. Return the result list containing all the lonely numbers.\n\n# Code\n```\nclass Solution {\n    fun findLonely(nums: IntArray): List<Int> {\n         val frequencyMap = HashMap<Int, Int>()\n\n    // First find the number of same num occurance in nums list\n    for (num in nums) {\n        frequencyMap[num] = frequencyMap.getOrDefault(num, 0) + 1\n    }\n\n    val lonelyNumbers = mutableListOf<Int>()\n\n    // Identify the lonely numbers\n    // 1. If the frequency of num is more then 1 means it\'s not lonley\n    // 2. Check by incrementing the num by 1 or decrementing num by 1 to see if next or previous number is present\n    // a. In case of present means it\'s not lonely\n    // b. In case of not present means it\'s lonely as frequency of that number is also once\n    for (num in nums) {\n        if (frequencyMap[num] == 1) {\n            var isLonely = if (frequencyMap.containsKey(num - 1) || frequencyMap.containsKey(num + 1)){\n                false\n            } else {\n                true\n            }\n\n            if (isLonely) {\n                lonelyNumbers.add(num)\n            }\n        }\n\n    }\n\n        return lonelyNumbers\n    }\n}\n```
['Kotlin']