Closed PinkyWalia closed 3 years ago
Given an array of positive numbers and a positive number ‘S’, find the length of the smallest contiguous subarray whose sum is greater than or equal to ‘S’. Return 0, if no such subarray exists.
Input: [2, 1, 5, 2, 3, 2], S=7 Output: 2
Given an array of positive numbers and a positive number ‘S’, find the length of the smallest contiguous subarray whose sum is greater than or equal to ‘S’. Return 0, if no such subarray exists.
Input: [2, 1, 5, 2, 3, 2], S=7 Output: 2