Leetcode 862. Shortest Subarray with Sum at Least K
Find the length of the shortest contiguous subarray whose sum is at least k, or return -1 if none exists. Because nums can contain negative values (n up to 1e5), this requires using prefix sums with a monotonic deque (or equivalent) rather than a simple two-pointer sliding window.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Early January, 2025
Meta
Staff
Hello Interview Premium
Your account is free and you can post anonymously if you choose.