Skip to content

Commit 4941134

Browse files
committed
leetcode_1877
1 parent cc634cb commit 4941134

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
int minPairSum(vector<int>& nums) {
4+
sort(nums.begin(), nums.end());
5+
int i=-1, j=nums.size(), ret=0;
6+
while(i<j){
7+
if(ret<nums[++i]+nums[--j])
8+
ret=nums[i]+nums[j];
9+
}
10+
return ret;
11+
}
12+
};

0 commit comments

Comments
 (0)