```
class Solution {
public int numSubarrayProductLessThanK(int[] nums, int k) {
int ans = 0;
int combo = 0;
int prod = 1;
for (int i = 0; i < nums.length; ++i) {
++combo;
prod *= nums[i];
while (prod >= k && combo > 0) {
prod /= nums[i - --combo];
}
ans += combo;
}
return ans;
}
}
```