Easiest solution 
IntuitionSum of digits on every element.ApproachEdit array elements with their sum then sort it and return the smallest element.Complexity

Time complexity:
O(n
# Intuition
Sum of digits on every element.

# Approach
Edit array elements with their sum then sort it and return the smallest element.

# Complexity
- Time complexity:
O(n logn).

- Space complexity:
O(1).

# Code
```cpp []
class Solution {
public:
    int minElement(vector<int>& nums) {
        for(int i=0;i<nums.size();i++){
            int sum=0;
            while(nums[i]>0){
                sum+=nums[i]%10;
                nums[i]/=10;
            }
            nums[i]=sum;
        }
        sort(nums.begin(),nums.end());
        return nums[0];
    }
};
```
['C++']