713. Subarray Product Less Than K
用two pointer
持续记录目前的product
若product有超过就移动左边
否则就持续移动右边
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
int r=0;
int l=0;
int cur_pro = 1;
int ans = 0;
for(int r=0; r<nums.size(); r++)
{
cur_pro *= nums[r];
while(cur_pro >= k && l<=r)
{
cur_pro /= nums[l];
l++;
}
ans += (r-l+1);
}
return ans;
}