Posted on

Description

Submission

class Solution {
public:
    int minPairSum(vector<int>& nums) {
        sort(nums.begin(), nums.end());
        int n = nums.size();

        int ret = 0;
        for(int i = 0; i < nums.size() / 2; ++i) {
            ret = max(ret, nums[i] + nums[n-1-i]);
        }
        return ret;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *