package leetcode;

/**
 * https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold/
 */
public class Problem1283 {
    public int smallestDivisor(int[] nums, int threshold) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1283 prob = new Problem1283();
        System.out.println(prob.smallestDivisor(new int[]{1, 2, 5, 9}, 6)); // 5
        System.out.println(prob.smallestDivisor(new int[]{2, 3, 5, 7, 11}, 11)); // 3
        System.out.println(prob.smallestDivisor(new int[]{19}, 5)); // 4
    }
}

@@ -197,15 +197,324 @@
     
-// TODO
+int answer = 0;%0A        for (int i = 1; i %3C= 1000000; i++) %7B%0A            int sum = 0;%0A            for (int num : nums) %7B%0A                sum += -Math.floorDiv(-num, i); // opposite of ceilDiv%0A            %7D%0A            if (sum %3C= threshold) %7B%0A                answer = i;%0A                break;%0A            %7D%0A        %7D
 %0A   
@@ -525,17 +525,22 @@
  return 
-0
+answer
 ;%0A    %7D%0A

Update problem 1283