“`cpp
class Solution {
public:
int arrayPairSum(vector& nums) {
sort(nums.begin(), nums.end());
int sum = 0;
for (int i = 0; i < nums.size(); i += 2)sum += nums[i];
return sum;
}
};
···
561. Array Partition I
最新推荐文章于 2022-01-31 22:01:47 发布