#3736

Minimum Moves to Equal Array Elements III

easy · 81.3% accepted · 35 likes · top 93%

array · math

Description

You are given an integer array nums.

In one move, you may increase the value of any single element nums[i] by 1.

Return the minimum total number of moves required so that all elements in nums become equal.

Solution