Can you solve this algorithmic problem using an optimized approach?
Implement min_subarray_len(nums, target) to return the minimum length of a contiguous subarray whose sum is at least target. All values in nums are positive integers; return 0 if no qualifying subarray exists.
Input: a list of positive integers and a positive integer target. Output: an integer representing the minimum qualifying length.
def min_subarray_len(nums, target):