Minimum Size Subarray Sum Java Solution - The Coding Shala
Home >> Interview Question >> Minimum size subarray sum
Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum = s. If there isn't one, return 0 instead.
Input: s = 7, nums = [2,3,1,2,4,3]
Explanation: the subarray [4,3] has the minimal length under the problem constraint.
Minimum Size Subarray Sum Java Solution
Use two pointers.
Other Posts You May Like