01 · Question
Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray whose sum is at least target. If there is no such subarray, return 0.
02 · Analysis
Add the rightmost value to the running sum. While the sum is at least target, record the current length before removing the leftmost value. Positive values guarantee that expansion cannot reduce the sum and shrinking cannot increase it. Both pointers advance at most n times: O(n) time, O(1) space. Return 0 when the best-length sentinel is unchanged.