1. Description
2. Solution
代码语言:javascript复制class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
if(k <= 1) {
return 0;
}
int i = 0;
int j = 0;
int count = 0;
int product = 1;
while(j < nums.size()) {
product *= nums[j];
while(product >= k) {
product /= nums[i];
i ;
}
count = j - i 1;
j ;
}
return count;
}
};