1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组 <code>nums</code> <strong>(下标从 0 开始)</strong>和一个整数 <code>k</code> 。</p>\n\n<p>一个子数组 <code>(i, j)</code> 的 <strong>分数</strong> 定义为 <code>min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)</code> 。一个 <strong>好</strong> 子数组的两个端点下标需要满足 <code>i &lt;= k &lt;= j</code> 。</p>\n\n<p>请你返回 <strong>好</strong> 子数组的最大可能 <strong>分数</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>nums = [1,4,3,7,4,5], k = 3\n<b>输出:</b>15\n<b>解释:</b>最优子数组的左右端点下标是 (1, 5) ,分数为 min(4,3,7,4,5) * (5-1+1) = 3 * 5 = 15 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>nums = [5,5,4,5,4,1,1,1], k = 0\n<b>输出:</b>20\n<b>解释:</b>最优子数组的左右端点下标是 (0, 4) ,分数为 min(5,5,4,5,4) * (4-0+1) = 4 * 5 = 20 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 2 * 10<sup>4</sup></code></li>\n\t<li><code>0 &lt;= k &lt; nums.length</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 46,
"likes": 47,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 4351, \"totalSubmissionRaw\": 10261, \"acRate\": \"42.4%\"}",
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 4444, \"totalSubmissionRaw\": 10441, \"acRate\": \"42.6%\"}",
"hints": [
"Try thinking about the prefix before index k and the suffix after index k as two separate arrays.",
"Using two pointers or binary search, we can find the maximum prefix of each array where the numbers are less than or equal to a certain value"