Given an array of positive integers nums and a positive integer target, return the minimum length of a subarray whose sum is greater than or equal to target. Return 0 if no such subarray exists.
target = 7, nums = [2,3,1,2,4,3]2Since all elements are positive, adding an element always increases the sum and removing one always decreases it. This monotonic property lets us use two pointers: expand right to grow the sum until it meets the target, then shrink left to find the tightest valid window. Each element is added and removed at most once, giving O(n) overall.