Minimum Size Subarray Sum

Given an array of positive integers, determine the minimal length of a subarray such that the sum is greater than or equal to a given target. Return 0 if no such subarray exists.

Constraints

  • 1 <= target <= 10^9
  • 1 <= nums.length <= 10^5
  • 1 <= nums[i] <= 10^4
Saving… · 2 lines
class Solution:
def minSubArrayLen(self, target: int, nums: List[int]) -> int:
Console

Click Run to execute sample tests.