public class Solution { public int MinMoves(int[] nums) { var list = nums.OrderBy(x => x).ToList(); var sum = 0; for (int i = 1; i < list.Count; i++) { sum += list[i] - list[0]; } Console.WriteLine(sum); return sum; } }
https://leetcode.com/problems/minimum-moves-to-equal-array-elements/#/description