Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minimum Moves (LC 462)
def minMoves2(self, nums: List[int]) -> int:
median = sorted(nums)[len(nums) // 2]
return sum(abs(num - median) for num in nums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment