@@ -0,0 +1,916 @@
+%22%22%22%0AGiven a non-empty integer array of size n, find the minimum number of moves%0Arequired to make all array elements equal, where a move is incrementing n - 1%0Aelements by 1.%0A%0AExample:%0A%0AInput:%0A%5B1,2,3%5D%0A%0AOutput:%0A3%0A%0AExplanation:%0AOnly three moves are needed (remember each move increments two elements):%0A%0A%5B1,2,3%5D  =%3E  %5B2,3,3%5D  =%3E  %5B3,4,3%5D  =%3E  %5B4,4,4%5D%0A%22%22%22%0Aclass Solution(object):%0A    def minMoves(self, nums):%0A        %22%22%22%0A        :type nums: List%5Bint%5D%0A        :rtype: int%0A        %22%22%22%0A        return sum(nums) - len(nums) * min(nums)%0A%0Aassert Solution().minMoves(%5B1,2,3%5D) == 3%0Aprint('pass')%0A%0A%22%22%22%0ANote:%0A    Math problem, add 1 to n - 1 elements is equivalent to add 1 to all elements%0A    and substract 1 from 1 element.  Adding 1 to all element doesn't change the%0A    equality property, so the problem become finding out the number of steps%0A    needed to make all element equal by substract 1 from 1 element at each step%0A%22%22%22%0A

add 453