Find shortest subarray with sum . Use prefix sums: . We want , i.e., .
For each , find smallest valid . Maintain monotonic increasing deque of prefix indices. For each , pop front while . After popping, if queue non-empty, the popped indices give valid subarrays. Track minimum length. Also pop back if .