package leetcode;

/**
 * https://leetcode.com/problems/minimize-maximum-pair-sum-in-array/
 */
public class Problem1877 {
    public int minPairSum(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1877 prob = new Problem1877();
        System.out.println(prob.minPairSum(new int[]{3,5,2,3})); // 7
        System.out.println(prob.minPairSum(new int[]{3,5,4,2,4,6})); // 8
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -194,38 +194,55 @@
     
-// TODO%0A        return
+Arrays.sort(nums);%0A        int answer =
  0;%0A    
 %7D%0A%0A 
@@ -241,245 +241,158 @@
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1877 prob = new Problem1877();%0A        System.out.println(prob.minPairSum(new int%5B%5D%7B3,5,2,3%7D)); // 7%0A        System.out.println(prob.minPairSum(new int%5B%5D%7B3,5,4,2,4,6%7D)); // 8
+for (int i = 0, j = nums.length - 1; i %3C j; i++, j--) %7B%0A            answer = Math.max(answer, nums%5Bi%5D + nums%5Bj%5D);%0A        %7D%0A        return answer;
 %0A   

Solve problem 1877