网站建设取得实效,电子商务课程视频,什么是软文写作,百度seo2022链接#xff1a;LintCode 炼码 - ChatGPT#xff01;更高效的学习体验#xff01;
题解#xff1a;同向双指针
九章算法 - 帮助更多程序员找到好工作#xff0c;硅谷顶尖IT企业工程师实时在线授课为你传授面试技巧
class Solution {
public:/*** param nums: an array … 链接LintCode 炼码 - ChatGPT更高效的学习体验
题解同向双指针
九章算法 - 帮助更多程序员找到好工作硅谷顶尖IT企业工程师实时在线授课为你传授面试技巧
class Solution {
public:/*** param nums: an array of integers* param s: An integer* return: an integer representing the minimum size of subarray*/int minimumSize(vectorint nums, int s) {// write your code hereint j 0;int sum 0;int len INT_MAX;for (int i 0; i nums.size(); i) {while (j nums.size() sum s) {sum nums[j];j;}if (sum s) {len min(len, j-i);}sum - nums[i];}return len INT_MAX ? -1 : len;}
};