滑动窗口
class Solution:
def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int:
start = 0
sums = 1
ans = 0
for i in range(len(nums)):
sums = sums * nums[i]
while sums >= k and start <= i:
sums = sums // nums[start]
start = start + 1
if sums < k:
ans = ans + i-start+1
return ans