package leetcode;

/**
 * https://leetcode.com/problems/minimum-difference-between-largest-and-smallest-value-in-three-moves/
 */
public class Problem1509 {
    public int minDifference(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1509 prob = new Problem1509();
        System.out.println(prob.minDifference(new int[]{5,3,2,4})); // 0
        System.out.println(prob.minDifference(new int[]{1,5,0,10,14})); // 1
        System.out.println(prob.minDifference(new int[]{6,6,0,1,1,4,6})); // 2
        System.out.println(prob.minDifference(new int[]{1,5,6,14,15})); // 1
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -231,32 +231,292 @@
     
-// TODO%0A        return 0
+if (nums.length %3C= 4) %7B%0A            return 0;%0A        %7D%0A        Arrays.sort(nums);%0A        int answer = Integer.MAX_VALUE;%0A        for (int i = 0, j = nums.length - 2; i %3C 3; i++, j++) %7B%0A            answer = Math.min(answer, nums%5Bj - 1%5D - nums%5Bi + 1%5D);%0A        %7D%0A        return answer
 ;%0A  
@@ -611,16 +611,18 @@
 1509();%0A
+//
         
@@ -686,16 +686,16 @@
 ); // 0%0A
-
         
@@ -759,24 +759,105 @@
 14%7D)); // 1%0A
+//        System.out.println(prob.minDifference(new int%5B%5D%7B3,5,0,10,14%7D)); // 2%0A//
         Syst
@@ -923,16 +923,18 @@
 ); // 2%0A
+//
         
@@ -1002,16 +1002,710 @@
 ); // 1%0A
+//        System.out.println(prob.minDifference(new int%5B%5D%7B1%7D)); // 0%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B1,2%7D)); // 0%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B1,2%7D)); // 0%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B1,2,3%7D)); // 0%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B1,2,3,100%7D)); // 0%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B82,81,95,75,20%7D)); // 1%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B82,81,95,75,20,98%7D)); // 7%0A//        System.out.println(prob.minDifference(new int%5B%5D%7B448,433,498,103,81,537,995,376,286,737,132,702,740,446,811,709,578,534,821,730,216,1,344,192,645%7D)); // 718%0A
     %7D%0A%7D%0A

Update problem 1509