Arrays.sort(nums);
int res=0;
for (int i = 0; i <nums.length ; i++) {
if(i%2==0)res+=nums[i];
}
return res;
LeetCode简单题561.数组拆分
最新推荐文章于 2024-11-15 22:13:14 发布
Arrays.sort(nums);
int res=0;
for (int i = 0; i <nums.length ; i++) {
if(i%2==0)res+=nums[i];
}
return res;