Tap here to switch tabs
Problem
Submissions

Problem: Minimum Positive Sum Subarray

med
30 min
Try to solve the Minimum Positive Sum Subarray problem.

Statement

You are given an integer array nums and two integers l and r.

Find the minimum sum of a contiguous subarray whose length is between l and r, inclusive, such that the sum is strictly greater than 00.

Return the minimum positive sum among all valid subarrays. If no such subarray exists, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq l ≤\leq r ≤\leq nums.length

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Positive Sum Subarray

med
30 min
Try to solve the Minimum Positive Sum Subarray problem.

Statement

You are given an integer array nums and two integers l and r.

Find the minimum sum of a contiguous subarray whose length is between l and r, inclusive, such that the sum is strictly greater than 00.

Return the minimum positive sum among all valid subarrays. If no such subarray exists, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq l ≤\leq r ≤\leq nums.length

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000