mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-08 17:01:42 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>沿街有一排连续的房屋。每间房屋内都藏有一定的现金。现在有一位小偷计划从这些房屋中窃取现金。</p>\n\n<p>由于相邻的房屋装有相互连通的防盗系统,所以小偷 <strong>不会窃取相邻的房屋</strong> 。</p>\n\n<p>小偷的 <strong>窃取能力</strong> 定义为他在窃取过程中能从单间房屋中窃取的 <strong>最大金额</strong> 。</p>\n\n<p>给你一个整数数组 <code>nums</code> 表示每间房屋存放的现金金额。形式上,从左起第 <code>i</code> 间房屋中放有 <code>nums[i]</code> 美元。</p>\n\n<p>另给你一个整数 <code>k</code> ,表示窃贼将会窃取的 <strong>最少</strong> 房屋数。小偷总能窃取至少 <code>k</code> 间房屋。</p>\n\n<p>返回小偷的 <strong>最小</strong> 窃取能力。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,3,5,9], k = 2\n<strong>输出:</strong>5\n<strong>解释:</strong>\n小偷窃取至少 2 间房屋,共有 3 种方式:\n- 窃取下标 0 和 2 处的房屋,窃取能力为 max(nums[0], nums[2]) = 5 。\n- 窃取下标 0 和 3 处的房屋,窃取能力为 max(nums[0], nums[3]) = 9 。\n- 窃取下标 1 和 3 处的房屋,窃取能力为 max(nums[1], nums[3]) = 9 。\n因此,返回 min(5, 9, 9) = 5 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,7,9,3,1], k = 2\n<strong>输出:</strong>2\n<strong>解释:</strong>共有 7 种窃取方式。窃取能力最小的情况所对应的方式是窃取下标 0 和 4 处的房屋。返回 max(nums[0], nums[4]) = 2 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= nums[i] <= 10<sup>9</sup></code></li>\n\t<li><code>1 <= k <= (nums.length + 1)/2</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 211,
|
||||
"likes": 212,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"24.3K\", \"totalSubmission\": \"40.3K\", \"totalAcceptedRaw\": 24312, \"totalSubmissionRaw\": 40324, \"acRate\": \"60.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"24.3K\", \"totalSubmission\": \"40.3K\", \"totalAcceptedRaw\": 24317, \"totalSubmissionRaw\": 40329, \"acRate\": \"60.3%\"}",
|
||||
"hints": [
|
||||
"Can we use binary search to find the minimum value of a non-contiguous subsequence of a given size k?",
|
||||
"Initialize the search range with the minimum and maximum elements of the input array.",
|
||||
|
Reference in New Issue
Block a user