class Solution {
public:
int minSubArrayLen(int s, vector<int>& nums) {
int sum = 0, min_size = nums.size() + 1, j = 0;
for(int i = 0; i < nums.size(); i++) {
while(j < nums.size() && sum < s) {
sum += nums[j++];
}
min_size = sum >= s ? min(min_size, j  i) : min_size;
sum = nums[i];
}
return min_size > nums.size() ? 0 : min_size;
}
};
c++ O(n) solution


hello dr.pro
I don't think this is a O(n) solution, can you explain it to me?
thanks very much~