arrays
sliding-window
two-pointers
Given a positive integer target and an array nums of positive integers, return the minimum length of a contiguous subarray whose sum is at least target. If no such subarray exists, return 0.
Examples
Example 1
Input: target = 7, nums = [2,3,1,2,4,3]
Output: 2
Example 2
Input: target = 4, nums = [1,4,4]
Output: 1
Example 3
Input: target = 11, nums = [1,2,3,4,5]
Output: 3
🔒 5 hidden
Running will execute all 8 cases, including 5 hidden ones.