3300 . Minimum Element After Replacement With Digit Sum  Beat 100% 
IntuitionApproachComplexity
Time complexity:
O(Nlogn)
Space complexity:
O(N)Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(Nlogn)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(N)
# Code
```cpp []
class Solution {
public:
    int minElement(vector<int>& nums) {
        for(int i=0;i<nums.size();i++) {
            nums[i] = sum(nums[i]);
        }
        sort(nums.begin(),nums.end());
        return nums[0];
    }
    int sum(int n) {
        int s = 0;
        while(n != 0) {
            s += (n % 10);
            n /= 10;
        }
        return s;
    }
};
```
['Array', 'Math', 'C++']