NeetCode #379LC-862HardStack
← Back to All Problems#379 · #862 · Shortest Subarray with Sum at Least K(和至少为 K 的最短子数组)
📌 Problem Statement & Constraints
Given an integer array
nums and an integer k, return the length of the shortest non-empty subarray with a sum of at least k. If no such subarray exists, return -1. Constraints: 1 <= nums.length <= 10^5, -10^5 <= nums[i] <= 10^5, 1 <= k <= 10^9.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!