453. Minimum Moves to Equal Array Elements
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 58% Topics: Array, Math
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
class Solution(object):
def minMoves(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return sum(nums) - len(nums) * min(nums)
Solution from kamyu104/LeetCode-Solutions · MIT