1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/子数组最小乘积的最大值 [maximum-subarray-min-product].html
2022-03-29 12:43:11 +08:00

50 lines
1.9 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>一个数组的 <strong>最小乘积</strong> 定义为这个数组中 <strong>最小值</strong> <strong>乘以 </strong>数组的 <strong></strong> 。</p>
<ul>
<li>比方说,数组 <code>[3,2,5]</code> (最小值是 <code>2</code>)的最小乘积为 <code>2 * (3+2+5) = 2 * 10 = 20</code> 。</li>
</ul>
<p>给你一个正整数数组 <code>nums</code> ,请你返回 <code>nums</code> 任意 <strong>非空子数组</strong> 的<strong>最小乘积</strong> 的 <strong>最大值</strong> 。由于答案可能很大,请你返回答案对  <code>10<sup>9</sup> + 7</code> <strong>取余 </strong>的结果。</p>
<p>请注意,最小乘积的最大值考虑的是取余操作 <strong>之前</strong> 的结果。题目保证最小乘积的最大值在 <strong>不取余</strong> 的情况下可以用 <strong>64 位有符号整数</strong> 保存。</p>
<p><strong>子数组</strong> 定义为一个数组的 <strong>连续</strong> 部分。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>nums = [1,<strong>2,3,2</strong>]
<b>输出:</b>14
<b>解释:</b>最小乘积的最大值由子数组 [2,3,2] (最小值是 2得到。
2 * (2+3+2) = 2 * 7 = 14 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>nums = [2,<strong>3,3</strong>,1,2]
<b>输出:</b>18
<b>解释:</b>最小乘积的最大值由子数组 [3,3] (最小值是 3得到。
3 * (3+3) = 3 * 6 = 18 。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<b>输入:</b>nums = [3,1,<strong>5,6,4</strong>,2]
<b>输出:</b>60
<b>解释:</b>最小乘积的最大值由子数组 [5,6,4] (最小值是 4得到。
4 * (5+6+4) = 4 * 15 = 60 。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
<li><code>1 <= nums[i] <= 10<sup>7</sup></code></li>
</ul>