mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-03 06:22:54 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>arr</code>,请你检查是否存在两个整数 <code>N</code> 和 <code>M</code>,满足 <code>N</code> 是 <code>M</code> 的两倍(即,<code>N = 2 * M</code>)。</p>\n\n<p>更正式地,检查是否存在两个下标 <code>i</code> 和 <code>j</code> 满足:</p>\n\n<ul>\n\t<li><code>i != j</code></li>\n\t<li><code>0 <= i, j < arr.length</code></li>\n\t<li><code>arr[i] == 2 * arr[j]</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>arr = [10,2,5,3]\n<strong>输出:</strong>true\n<strong>解释:</strong>N<code> = 10</code> 是 M<code> = 5 的两倍</code>,即 <code>10 = 2 * 5 。</code>\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>arr = [7,1,14,11]\n<strong>输出:</strong>true\n<strong>解释:</strong>N<code> = 14</code> 是 M<code> = 7 的两倍</code>,即 <code>14 = 2 * 7 </code>。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>arr = [3,1,7,11]\n<strong>输出:</strong>false\n<strong>解释:</strong>在该情况下不存在 N 和 M 满足 N = 2 * M 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= arr.length <= 500</code></li>\n\t<li><code>-10^3 <= arr[i] <= 10^3</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 48,
|
||||
"likes": 52,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"18.5K\", \"totalSubmission\": \"43.1K\", \"totalAcceptedRaw\": 18539, \"totalSubmissionRaw\": 43130, \"acRate\": \"43.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"20.5K\", \"totalSubmission\": \"47.7K\", \"totalAcceptedRaw\": 20538, \"totalSubmissionRaw\": 47675, \"acRate\": \"43.1%\"}",
|
||||
"hints": [
|
||||
"Loop from i = 0 to arr.length, maintaining in a hashTable the array elements from [0, i - 1].",
|
||||
"On each step of the loop check if we have seen the element 2 * arr[i] so far or arr[i] / 2 was seen if arr[i] % 2 == 0."
|
||||
|
Reference in New Issue
Block a user