It 's not clear why , but it 's interesting . ♥️
🧐Intuitionthe first idea is of course a nested loop, but the second idea says that a nested loop is not bad, but bad🎯What they want from usпосчитать сумму чисел
# 🧐Intuition
the first idea is of course a nested loop, but the second idea says that a nested loop is not bad, but bad

# 🎯What they want from us
посчитать сумму чисел в самом числе и найти то которая будет больше
```
18,43,36,7
```
|index  | val   |Sum|comment|
|-------|-------|---|-------|
|0      |18     | 9 |We write it in Map 9|
|1      |43     | 7 |We write it in Map 7|
|2      |36     |9  | we are searching in Map 9 and updating res|
|3      |7      |3  | we throw it into Map 7 and don't update res| 


# 🛠️the work front

The maximum possible sum of digits occurs when **999999999**
9+9+9+9+9+9+9+9+9 = **81**
We use size **82 (from 0 to 81)** for direct indexing.
```
res, mp := -1, [82]int{}
```
 ⚒️**we create a duplicate of v to calculate the sum of all its numbers and reset the sum**
```
val, sum := v, 0
```
📒**counting the Sum**
```
for val > 0 {
            sum += val % 10 
            val /= 10
        }
```
🆙**updating res**
```
if mp[sum] > 0 {
            res = max(res, v + mp[sum])
        } 
```

🚀**checking for a single number**
 ```
mp[sum] = max(mp[sum], v)
```




# ⌛Complexity
- Time complexity:$$O(N)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:$$O(1)$$ -The map has a constant size.
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# ♥️Code
```golang []
func maximumSum(nums []int) int {
    res, mp := -1, [82]int{}
    for _, v := range nums {
        val, sum := v, 0
        for val > 0 {
            sum += val % 10 
            val /= 10
        }
        if mp[sum] > 0 {
            res = max(res, v + mp[sum])
        } 
        mp[sum] = max(mp[sum], v)
    } 
    return res
}
```
['Go']