标签:for elements span amp cep auto ini end nts
Increasing all elements by 1 except one element, equals to decreasing that one element.
class Solution { public: int minMoves(vector<int>& nums) { int minv = *min_element(nums.begin(), nums.end()); int ret = 0; for(auto v : nums) ret += v - minv; return ret; } };
LeetCode "Minimum Moves to Equal Array Elements"
标签:for elements span amp cep auto ini end nts
原文地址:http://www.cnblogs.com/tonix/p/6056447.html