mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-08 08:51:42 +08:00
update
This commit is contained in:
@@ -12,18 +12,30 @@
|
||||
"translatedContent": "<p>一张桌子上总共有 <code>n</code> 个硬币 <b>栈</b> 。每个栈有 <strong>正整数</strong> 个带面值的硬币。</p>\n\n<p>每一次操作中,你可以从任意一个栈的 <strong>顶部</strong> 取出 1 个硬币,从栈中移除它,并放入你的钱包里。</p>\n\n<p>给你一个列表 <code>piles</code> ,其中 <code>piles[i]</code> 是一个整数数组,分别表示第 <code>i</code> 个栈里 <strong>从顶到底</strong> 的硬币面值。同时给你一个正整数 <code>k</code> ,请你返回在 <strong>恰好</strong> 进行 <code>k</code> 次操作的前提下,你钱包里硬币面值之和 <strong>最大为多少</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/11/09/e1.png\" style=\"width: 600px; height: 243px;\" /></p>\n\n<pre>\n<b>输入:</b>piles = [[1,100,3],[7,8,9]], k = 2\n<b>输出:</b>101\n<strong>解释:</strong>\n上图展示了几种选择 k 个硬币的不同方法。\n我们可以得到的最大面值为 101 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>piles = [[100],[100],[100],[100],[100],[100],[1,1,1,1,1,1,700]], k = 7\n<b>输出:</b>706\n<strong>解释:\n</strong>如果我们所有硬币都从最后一个栈中取,可以得到最大面值和。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == piles.length</code></li>\n\t<li><code>1 <= n <= 1000</code></li>\n\t<li><code>1 <= piles[i][j] <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= k <= sum(piles[i].length) <= 2000</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 27,
|
||||
"likes": 35,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": "{\"cpp\": false, \"java\": true, \"python\": true, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Array",
|
||||
"slug": "array",
|
||||
"translatedName": "数组",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Dynamic Programming",
|
||||
"slug": "dynamic-programming",
|
||||
"translatedName": "动态规划",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Prefix Sum",
|
||||
"slug": "prefix-sum",
|
||||
"translatedName": "前缀和",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
@@ -137,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.4K\", \"totalSubmission\": \"6.8K\", \"totalAcceptedRaw\": 3414, \"totalSubmissionRaw\": 6776, \"acRate\": \"50.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"8.4K\", \"totalAcceptedRaw\": 4438, \"totalSubmissionRaw\": 8399, \"acRate\": \"52.8%\"}",
|
||||
"hints": [
|
||||
"For each pile i, what will be the total value of coins we can collect if we choose the first j coins?",
|
||||
"How can we use dynamic programming to combine the results from different piles to find the most optimal answer?"
|
||||
|
Reference in New Issue
Block a user