1856. Maximum Subarray Min-Product
https://leetcode.com/problems/maximum-subarray-min-product
Description
The min-product of an array is equal to the minimum value in the array multiplied by the array's sum.
For example, the array
[3,2,5]
(minimum value is2
) has a min-product of2 * (3+2+5) = 2 * 10 = 20
.
Given an array of integers nums
, return the maximum min-product of any non-empty subarray of nums
. Since the answer may be large, return it modulo 109 + 7
.
Note that the min-product should be maximized before performing the modulo operation. Testcases are generated such that the maximum min-product without modulo will fit in a 64-bit signed integer.
A subarray is a contiguous part of an array.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= nums.length <= 105
1 <= nums[i] <= 107
ac
Previous1855. Maximum Distance Between a Pair of ValuesNext1857. Largest Color Value in a Directed Graph
Last updated