class Solution(object):
def minMoves2(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
mid=len(nums)/2
return sum(nums[mid+len(nums)%2:])-sum(nums[:mid])
class Solution(object):
def minMoves2(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
mid=len(nums)/2
return sum(nums[mid+len(nums)%2:])-sum(nums[:mid])
本文标题:462. Minimum Moves to Equal Arra
本文链接:https://www.haomeiwen.com/subject/gkfqvttx.html
网友评论