int minSubArrayLen(int target, int* nums, int numsSize) {
    int sum=nums[0],head=0,tail=0,min=INT_MAX;
    int t=0;
    for(int i=0;i<numsSize;i++){
        t+=nums[i];
    }
    if(t<target) return 0;
    while(head<=tail&&tail<numsSize){
        if(sum>=target){
            if(min>tail-head+1) min=tail-head+1;
            sum-=nums[head++];
        }else{
            if(tail==numsSize-1) break;
            tail++;
            sum+=nums[tail];
        }
    }
    return min;
}

还得练,DEBUG了半天