#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param nums int整型一维数组 
# @param target int整型 
# @return int整型
#
class Solution:
    def minSubarray(self , nums: List[int], target: int) -> int:
        # write code here
        n, total, l = len(nums), 0, 0#数组长度,滑动窗口内数组总和,滑动窗口左下标
        ans = n+1#最短连续子数组长度
        for i in range(n):#遍历整个数组
            total += nums[i]#滑动窗口向右拓展
            while total>=target:#滑动窗口左边界收缩
                ans = min(ans,i-l+1)
                total -= nums[l]
                l += 1
        return ans#返回答案