public class Solution { public int MinMoves2(int[] nums) { var list = nums.OrderBy(x => x).ToList(); var mid = list[list.Count / 2]; var count = 0; for (int i = 0; i < nums.Length; i++) { var cur = nums[i]; if (cur != mid) { count += Math.Abs(cur - mid); } } return count; }}