1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 15:01:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个数字数组 <code>arr</code> 。</p>\n\n<p>如果一个数列中,任意相邻两项的差总等于同一个常数,那么这个数列就称为 <strong>等差数列</strong> 。</p>\n\n<p>如果可以重新排列数组形成等差数列,请返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>arr = [3,5,1]\n<strong>输出:</strong>true\n<strong>解释:</strong>对数组重新排序得到 [1,3,5] 或者 [5,3,1] ,任意相邻两项的差分别为 2 或 -2 ,可以形成等差数列。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>arr = [1,2,4]\n<strong>输出:</strong>false\n<strong>解释:</strong>无法通过重新排序得到等差数列。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= arr.length &lt;= 1000</code></li>\n\t<li><code>-10^6 &lt;= arr[i] &lt;= 10^6</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 21,
"likes": 23,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"31.2K\", \"totalSubmission\": \"43.9K\", \"totalAcceptedRaw\": 31172, \"totalSubmissionRaw\": 43916, \"acRate\": \"71.0%\"}",
"stats": "{\"totalAccepted\": \"31.3K\", \"totalSubmission\": \"44.1K\", \"totalAcceptedRaw\": 31323, \"totalSubmissionRaw\": 44136, \"acRate\": \"71.0%\"}",
"hints": [
"Consider that any valid arithmetic progression will be in sorted order.",
"Sort the array, then check if the differences of all consecutive elements are equal."