Simple solution in Java. Beats 100 %
Complexity

Time complexity:
O(n * log m)
(where n is the number of elements in the nums array and m is the maximum value in the array)


Space complexity:
O(1)
# Complexity
- Time complexity:
O(n * log m)
*(where n is the number of elements in the nums array and m is the maximum value in the array)*

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public int minElement(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            nums[i] = sumOfDigits(nums[i]);
        }

        int min = Integer.MAX_VALUE;
        for (int num : nums) {
            if (num < min) {
                min = num;
            }
        }
        return min;
    }

    private int sumOfDigits(int n) {
        int sum = 0;
        while (n > 0) {
            int lastDigit = n % 10;
            sum += lastDigit;
            n /= 10;
        }
        return sum;
    }
}
```
['Java']