1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +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>你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都 <strong>围成一圈</strong> ,这意味着第一个房屋和最后一个房屋是紧挨着的。同时,相邻的房屋装有相互连通的防盗系统,<strong>如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警</strong> 。</p>\n\n<p>给定一个代表每个房屋存放金额的非负整数数组,计算你 <strong>在不触动警报装置的情况下</strong> ,今晚能够偷窃到的最高金额。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例&nbsp;1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,3,2]\n<strong>输出:</strong>3\n<strong>解释:</strong>你不能先偷窃 1 号房屋(金额 = 2然后偷窃 3 号房屋(金额 = 2, 因为他们是相邻的。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,1]\n<strong>输出:</strong>4\n<strong>解释:</strong>你可以先偷窃 1 号房屋(金额 = 1然后偷窃 3 号房屋(金额 = 3。\n&nbsp; 偷窃到的最高金额 = 1 + 3 = 4 。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3]\n<strong>输出:</strong>3\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 100</code></li>\n\t<li><code>0 &lt;= nums[i] &lt;= 1000</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 979,
"likes": 1020,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"House Robber\", \"titleSlug\": \"house-robber\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6253\\u5bb6\\u52ab\\u820d\"}, {\"title\": \"Paint House\", \"titleSlug\": \"paint-house\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u7c89\\u5237\\u623f\\u5b50\"}, {\"title\": \"Paint Fence\", \"titleSlug\": \"paint-fence\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6805\\u680f\\u6d82\\u8272\"}, {\"title\": \"House Robber III\", \"titleSlug\": \"house-robber-iii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6253\\u5bb6\\u52ab\\u820d III\"}, {\"title\": \"Non-negative Integers without Consecutive Ones\", \"titleSlug\": \"non-negative-integers-without-consecutive-ones\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u4e0d\\u542b\\u8fde\\u7eed1\\u7684\\u975e\\u8d1f\\u6574\\u6570\"}, {\"title\": \"Coin Path\", \"titleSlug\": \"coin-path\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u91d1\\u5e01\\u8def\\u5f84\"}]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"225.2K\", \"totalSubmission\": \"517.1K\", \"totalAcceptedRaw\": 225222, \"totalSubmissionRaw\": 517130, \"acRate\": \"43.6%\"}",
"stats": "{\"totalAccepted\": \"236.3K\", \"totalSubmission\": \"541.7K\", \"totalAcceptedRaw\": 236311, \"totalSubmissionRaw\": 541707, \"acRate\": \"43.6%\"}",
"hints": [
"Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the <a href =\"https://leetcode.com/problems/house-robber/description/\">House Robber</a>, which is already been solved."
],