...

/

Minimum Size Subarray Sum

Minimum Size Subarray Sum

Given an array of integers and a target, return the length of the shortest contiguous subarray whose sum is greater than or equal to the target.

We'll cover the following...

Statement

Given an array of positive integers, nums, along with a positive integer, target. Find the length of the shortest contiguous subarray whose sum is greater than or equal to the target. If there is no such subarray, return 0 instead.

Example

Sample input

target = 7
nums = [2,3,1,2,4,3]

Expected output

2

Try it yourself

#include <climits>
#include <iostream>
#include <vector>
using namespace std;
int MinSubArrayLen(int s, vector<int> &nums) {
// TODO: Write - Your - Code
return -1;
}

Solution

In this ...