Posted on

Description

Submission

class Solution {
public:
    int minMoves(vector<int>& nums) {
        int minimum = *min_element(nums.begin(), nums.end());
        
        int ret = 0;
        for(auto x: nums) {
            ret += x - minimum;
        }
        return ret;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *