package leetcode;

/**
 * https://leetcode.com/problems/minimum-increment-to-make-array-unique/
 */
public class Problem945 {
    public int minIncrementForUnique(int[] A) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem945 prob = new Problem945();
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -205,15 +205,213 @@
     
-// TODO
+Arrays.sort(A);%0A        int answer = 0;%0A        for (int i = 0, j = 1; j %3C A.length; i++, j++) %7B%0A            while (A%5Bj%5D %3C= A%5Bi%5D) %7B%0A                A%5Bj%5D++;%0A                answer++;%0A            %7D%0A        %7D
 %0A   
@@ -422,17 +422,22 @@
  return 
-0
+answer
 ;%0A    %7D%0A
@@ -526,16 +526,187 @@
 m945();%0A
+        System.out.println(prob.minIncrementForUnique(new int%5B%5D%7B1, 2, 2%7D)); // 1%0A        System.out.println(prob.minIncrementForUnique(new int%5B%5D%7B3, 2, 1, 2, 1, 7%7D)); // 6%0A
     %7D%0A%7D%0A

Update problem 945