EASY WAY - TRY THIS - THIS - THIS
IntuitionWe need to find the minimum element after replacing each number with the sum of its digits.So, we should convert each number to a string, sum its digit
# Intuition
We need to find the minimum element after replacing each number with the sum of its digits.

So, we should convert each number to a string, sum its digits, and store it.


---

# Approach
Loop through the input array.

Convert each nums[i] to a string and sum its digits.

Store the digit sums in an ArrayList.

Sort the list and return the smallest value (at index 0).

# Code
```java []
class Solution {
    public static int minElement(int[] nums) {
        
    	int n = nums.length;
        ArrayList<Integer> ans = new ArrayList<>();

    	for (int i = 0; i < n; i++) {
			
    		String s =  Integer.toString(nums[i]);
    		int sum = 0;
    		
            for (char ch : s.toCharArray()) {
    			
            	sum += ch - '0';
    		}
            
            ans.add(sum);
    		
		}
    	Collections.sort(ans);
    	
    	return ans.get(0);
    }
}
```
['Java']