mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-25 14:58:56 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个数组 <code>nums</code> ,数组中有 <code>2n</code> 个元素,按 <code>[x<sub>1</sub>,x<sub>2</sub>,...,x<sub>n</sub>,y<sub>1</sub>,y<sub>2</sub>,...,y<sub>n</sub>]</code> 的格式排列。</p>\n\n<p>请你将数组按 <code>[x<sub>1</sub>,y<sub>1</sub>,x<sub>2</sub>,y<sub>2</sub>,...,x<sub>n</sub>,y<sub>n</sub>]</code> 格式重新排列,返回重排后的数组。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [2,5,1,3,4,7], n = 3\n<strong>输出:</strong>[2,3,5,4,1,7] \n<strong>解释:</strong>由于 x<sub>1</sub>=2, x<sub>2</sub>=5, x<sub>3</sub>=1, y<sub>1</sub>=3, y<sub>2</sub>=4, y<sub>3</sub>=7 ,所以答案为 [2,3,5,4,1,7]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,2,3,4,4,3,2,1], n = 4\n<strong>输出:</strong>[1,4,2,3,3,2,4,1]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,1,2,2], n = 2\n<strong>输出:</strong>[1,2,1,2]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 500</code></li>\n\t<li><code>nums.length == 2n</code></li>\n\t<li><code>1 <= nums[i] <= 10^3</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 80,
|
||||
"likes": 82,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"58K\", \"totalSubmission\": \"69K\", \"totalAcceptedRaw\": 57991, \"totalSubmissionRaw\": 68979, \"acRate\": \"84.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"59K\", \"totalSubmission\": \"70.3K\", \"totalAcceptedRaw\": 59036, \"totalSubmissionRaw\": 70306, \"acRate\": \"84.0%\"}",
|
||||
"hints": [
|
||||
"Use two pointers to create the new array of 2n elements. The first starting at the beginning and the other starting at (n+1)th position. Alternate between them and create the new array."
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user