mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个用无限二维网格表示的花园,<strong>每一个</strong> 整数坐标处都有一棵苹果树。整数坐标 <code>(i, j)</code> 处的苹果树有 <code>|i| + |j|</code> 个苹果。</p>\n\n<p>你将会买下正中心坐标是 <code>(0, 0)</code> 的一块 <strong>正方形土地</strong> ,且每条边都与两条坐标轴之一平行。</p>\n\n<p>给你一个整数 <code>neededApples</code> ,请你返回土地的 <strong>最小周长</strong> ,使得 <strong>至少</strong> 有<strong> </strong><code>neededApples</code> 个苹果在土地 <strong>里面或者边缘上</strong>。</p>\n\n<p><code>|x|</code> 的值定义为:</p>\n\n<ul>\n\t<li>如果 <code>x >= 0</code> ,那么值为 <code>x</code></li>\n\t<li>如果 <code>x < 0</code> ,那么值为 <code>-x</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://pic.leetcode-cn.com/1627790803-qcBKFw-image.png\" style=\"width: 442px; height: 449px;\" />\n<pre>\n<b>输入:</b>neededApples = 1\n<b>输出:</b>8\n<b>解释:</b>边长长度为 1 的正方形不包含任何苹果。\n但是边长为 2 的正方形包含 12 个苹果(如上图所示)。\n周长为 2 * 4 = 8 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>neededApples = 13\n<b>输出:</b>16\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<b>输入:</b>neededApples = 1000000000\n<b>输出:</b>5040\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= neededApples <= 10<sup>15</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 14,
|
||||
"likes": 17,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.8K\", \"totalSubmission\": \"9.8K\", \"totalAcceptedRaw\": 4763, \"totalSubmissionRaw\": 9814, \"acRate\": \"48.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.9K\", \"totalSubmission\": \"10.1K\", \"totalAcceptedRaw\": 4898, \"totalSubmissionRaw\": 10057, \"acRate\": \"48.7%\"}",
|
||||
"hints": [
|
||||
"Find a formula for the number of apples inside a square with a side length L.",
|
||||
"Iterate over the possible lengths of the square until enough apples are collected."
|
||||
|
Reference in New Issue
Block a user