1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 14:32:54 +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>给你两个长度相同的整数数组&nbsp;<code>target</code>&nbsp;和&nbsp;<code>arr</code>&nbsp;。每一步中,你可以选择&nbsp;<code>arr</code>&nbsp;的任意 <strong>非空子数组</strong>&nbsp;并将它翻转。你可以执行此过程任意次。</p>\n\n<p><em>如果你能让 <code>arr</code>&nbsp;变得与 <code>target</code>&nbsp;相同,返回 True否则返回 False 。</em></p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>target = [1,2,3,4], arr = [2,4,1,3]\n<strong>输出:</strong>true\n<strong>解释:</strong>你可以按照如下步骤使 arr 变成 target\n1- 翻转子数组 [2,4,1] arr 变成 [1,4,2,3]\n2- 翻转子数组 [4,2] arr 变成 [1,2,4,3]\n3- 翻转子数组 [4,3] arr 变成 [1,2,3,4]\n上述方法并不是唯一的还存在多种将 arr 变成 target 的方法。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>target = [7], arr = [7]\n<strong>输出:</strong>true\n<strong>解释:</strong>arr 不需要做任何翻转已经与 target 相等。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>target = [3,7,9], arr = [3,7,11]\n<strong>输出:</strong>false\n<strong>解释:</strong>arr 没有数字 9 ,所以无论如何也无法变成 target 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>target.length == arr.length</code></li>\n\t<li><code>1 &lt;= target.length &lt;= 1000</code></li>\n\t<li><code>1 &lt;= target[i] &lt;= 1000</code></li>\n\t<li><code>1 &lt;= arr[i] &lt;= 1000</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 34,
"likes": 35,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"17.4K\", \"totalSubmission\": \"23.5K\", \"totalAcceptedRaw\": 17422, \"totalSubmissionRaw\": 23490, \"acRate\": \"74.2%\"}",
"stats": "{\"totalAccepted\": \"17.5K\", \"totalSubmission\": \"23.5K\", \"totalAcceptedRaw\": 17452, \"totalSubmissionRaw\": 23534, \"acRate\": \"74.2%\"}",
"hints": [
"Each element of target should have a corresponding element in arr, and if it doesn't have a corresponding element, return false.",
"To solve it easiely you can sort the two arrays and check if they are equal."