0453.cpp (277B)
1 class Solution { 2 public: 3 int minMoves(const vector<int> &nums) const { 4 const int n = size(nums); 5 const int sum = accumulate(begin(nums), end(nums), 0); 6 const int mini = *min_element(begin(nums), end(nums)); 7 return sum - mini * n; 8 } 9 };