Leetcode 561. Array Partition I
class Solution: def arrayPairSum(self, nums: List[int]) -> int: nums.sort() ans, i = 0, 0 while i < len(nums): ans += nums[i] i += 2 return ans
class Solution: def arrayPairSum(self, nums: List[int]) -> int: nums.sort() ans, i = 0, 0 while i < len(nums): ans += nums[i] i += 2 return ans