Kth Smallest Subarray Sum
Kth Smallest Subarray Sum Kth Smallest Subarray Sum finds the k-th smallest value among all contiguous subarray sums. For nonnegative arrays, subarray sums have a monotone structure. This allows binary search on the answer and a sliding window count for how many subarrays have sum at most a candidate value. Problem Given an array $A$ of length $n$ with nonnegative values and a 1-based rank $k$, find the k-th smallest...