leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1877.cpp (264B)


      1 class Solution {
      2   public:
      3     int minPairSum(vector<int> &nums) {
      4         sort(nums.begin(), nums.end());
      5         int res = INT_MIN, i = 0, j = nums.size() - 1;
      6         while (i < j)
      7             res = max(res, nums[i++] + nums[j--]);
      8         return res;
      9     }
     10 };