Approach Summary
Keep a running product. When product >= k, divide by the leftmost element. Each valid right position adds (right - left + 1) subarrays.
How to Recognize This Pattern
- Count subarrays with product constraint
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(1)
Tags
Array Sliding Window