标签:minimum int col return span style ini res solution
class Solution { public: int minSubArrayLen(int s, vector<int>& nums) { int w = 0, _sum = 0, res = INT_MAX; for (int i = 0; i < nums.size(); i++) { _sum += nums[i]; while (w <= i && _sum >= s) { res = min(res, i-w+1); _sum -= nums[w]; w++; } } return res == INT_MAX ? 0 : res; } };
209. Minimum Size Subarray Sum
标签:minimum int col return span style ini res solution
原文地址:https://www.cnblogs.com/JTechRoad/p/9066552.html