Minimum Moves to Equal Array Elements

Problem Id: 453 Difficulty: Easy


Intuition

Solution


class Solution(object):
    def minMoves(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        if not nums:
            return 0
        return sum(nums) - min(nums) * len(nums)