Count runs with a product below k
Given a list nums of positive integers and an integer k, count the contiguous, non-empty subarrays whose product is strictly less than k. Subarrays at different positions count separately: for [10, 5, 2, 6] and k = 100 the answer is 8 ([10], [5], [2], [6], [10, 5], [5, 2], [2, 6] and [5, 2, 6]).
nums may be empty; every value is ≥ 1 and 0 <= k <= 10^6. Aim for O(n): multiplying out every subarray is O(n²).
Besides the tests, one large input (6,000 values) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
count_low_product([10,5,2,6], 100)→8count_low_product([1,2,3], 0)→0count_low_product([1,1,1], 2)→6