题目链接:https://leetcode.cn/problems/minimum-element-after-replacement-with-digit-sum/
题解代码:
class Solution {
public:int minElement(vector<int>& nums) {vector<int> n;for(int i = 0;i < nums.size();i ++){int x = nums[i];int cnt = 0;while(x){cnt += x % 10;x /= 10;}n.push_back(cnt);}sort(n.begin(),n.end());return n[0];}
};