package leetcode;

/**
 * https://leetcode.com/problems/subarray-product-less-than-k/
 */
public class Problem713 {
    public int numSubarrayProductLessThanK(int[] nums, int k) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem713 prob = new Problem713();
        System.out.println(prob.numSubarrayProductLessThanK(new int[]{10, 5, 2, 6}, 100)); // 8
    }
}

@@ -185,15 +185,641 @@
     
-// TODO
+int result = 0;%0A        int totalProduct = 1;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            totalProduct *= nums%5Bi%5D;%0A        %7D%0A        if (totalProduct %3C k) %7B%0A            result++;%0A        %7D%0A        for (int i = 0, j = nums.length - 1; i %3C j; i++, j--) %7B%0A            int leftProduct = 1;%0A            for (int x = i; x %3C j; x++) %7B%0A                leftProduct *= nums%5Bx%5D;%0A                if (leftProduct %3C k) %7B%0A                    result++;%0A                %7D%0A                if (totalProduct / leftProduct %3C k) %7B%0A                    result++;%0A                %7D%0A            %7D%0A            totalProduct /= nums%5Bi%5D;%0A        %7D
 %0A   
@@ -830,17 +830,22 @@
  return 
-0
+result
 ;%0A    %7D%0A

Update problem 713