#3364

Minimum Positive Sum Subarray

pupil · 485 · lc easy +27 · 44.9% accepted · 158 likes · top 28%

Description

You are given an integer array nums and two integers l and r. Find the minimum positive sum of any subarray whose length falls in the range [l, r] (inclusive).

Return the minimum sum, or -1 if no such subarray exists.

A subarray is a contiguous non-empty sequence of elements within an array.

Code

1
2
3