public class Solution { public int ArrayPairSum(int[] nums) { var list = nums.OrderBy(x => x).ToList(); var sum = 0; for (int i = 0; i < list.Count; i += 2) { sum += list[i]; } return sum; } }
https://leetcode.com/problems/array-partition-i/#/description