Leetcode713
思路
解答
class Solution {
    public int numSubarrayProductLessThanK(int[] nums, int k) {
        if(k < 1){
            return 0;
        }
        int ans = 0;
        int product = 1;
        int left = 0;
        for(int right = 0 ; right < nums.length ; right++){
            product *= nums[right];
            while(product >= k && left <= right){
                product /= nums[left];
                left++;
            }
            ans += right-left +1;
        }
        return ans;
    }
}
時間空間複雜度
時間複雜度 : O(N^2)
兩層迴圈
空間複雜度 : O(N^2)
2-D陣列
example
Vocabulary
xxxx [KK] : (注意事項)

