🌟 Simple || Java || easy Approach || Beats 100%✅
Proof👇🏻https://leetcode.com/problems/minimum-element-after-replacement-with-digit-sum/submissions/1587782467Complexity
Time complexity:O(n)

Space complexity:O(
# Proof👇🏻
https://leetcode.com/problems/minimum-element-after-replacement-with-digit-sum/submissions/1587782467


# Complexity
- Time complexity:O(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) {
        for(int i=0; i<nums.length; i++){
            nums[i] = digitSum(nums[i]);
        }
        int min = Integer.MAX_VALUE;
        for(int i=0; i<nums.length; i++){
            min = (int)Math.min(min,nums[i]);
        }
        return min;
    }
    private int digitSum(int n){
        int sum =0;
        while(n>0){
            sum += n%10;
            n /= 10;
        }
        return sum;
    }
}
```
['Java']