while (l < nums.length) {
if (r + 1 < nums.length + 1 && sum < s) {//如果当前窗口的sum值小于s
r++;
sum += nums[r];//窗口右边界向右拓展
} else {
sum -= nums[l];
l++;
}
在这段代码中,if判断的事sum<s,那么他的else就是sum>=s,那为什么下面还是sum>=s?
if(sum>=s){
res =Math.max(res,r-l+1);
}