leetle

Daily challenge for 2025-12-19

353. Smallest Subarray Sum K

Given an array of positive integers nums and a positive integer k, find the length of the shortest contiguous subarray whose sum is greater than or equal to k. If no such subarray exists, return 0.

Example 1:
Input: nums = [2, 3, 1, 2, 4, 3], k = 7
Output: 2 (Subarray [4, 3])

Example 2:
Input: nums = [1, 4, 4], k = 4
Output: 1 (Subarray [4])

Run this challenge interactively in Python or JavaScript when the app loads.