#C13194. Minimum Size Subarray Sum
Minimum Size Subarray Sum
Minimum Size Subarray Sum
Given an array of positive integers and a target integer \( S \), determine the smallest length of a contiguous subarray for which the sum is greater than or equal to \( S \). If such a subarray does not exist, output 0.
The input is read from standard input (stdin). The first line contains two integers: \( n \) (the number of elements in the array) and \( S \) (the target sum). The second line contains \( n \) space-separated positive integers representing the array.
inputFormat
The first line contains two integers ( n ) and ( S ), where ( n ) is the number of elements in the array and ( S ) is the target sum. The second line contains ( n ) space-separated positive integers representing the array.
outputFormat
Print a single integer representing the minimal length of a contiguous subarray whose sum is at least ( S ). If no such subarray exists, print 0.## sample
6 7
2 3 1 2 4 3
2