Leetcode 561) Array Partition I
in Algorithms
class Solution {
public int arrayPairSum(int[] nums) {
Arrays.sort(nums);
int sum =0;
int ptr=0;
while(ptr<nums.length){
sum+=nums[ptr];
ptr+=2;
}
return sum;
}
}