Simple solution - beats 100% 🔥
Complexity
Time complexity: O(M * log N)

Space complexity: O(1)
Code

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

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int minElement(int[] nums) {
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < nums.length; i++) {
            min = Math.min(min, nums[i] = sumOfDigit(nums[i])); 
        }
        return min;
    }
public int sumOfDigit(int n) {
    int sum = 0;
    while (n > 0){
    sum += n % 10;
    n /= 10;
    }
    return sum;
    }
}
```
['Java']