[
math
array
]
BinarySearch 0420 List Equality with Increments
Problem statement
https://binarysearch.com/problems/List-Equality-with-Increments/
Solution
Equal to Leetcode 0453 Minimum Moves to Equal Array Elements.
Complexity
It is O(n)
for time and O(1)
for space.
Code
class Solution:
def solve(self, nums):
return sum(nums) - len(nums)*min(nums)