Minimum Size Subarray Sum
Medium · Arrays & Strings · about 15 minutes
Asked at Meta, Bloomberg, Microsoft, Amazon, Google.
Every value in nums is positive, and so is target. Find the shortest contiguous slice of nums whose values add up to at least target, and report its length. Report 0 when even the whole array falls short.