mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个整数数组 <code>arr1</code> 和 <code>arr2</code>,返回使 <code>arr1</code> 严格递增所需要的最小「操作」数(可能为 0)。</p>\n\n<p>每一步「操作」中,你可以分别从 <code>arr1</code> 和 <code>arr2</code> 中各选出一个索引,分别为 <code>i</code> 和 <code>j</code>,<code>0 <= i < arr1.length</code> 和 <code>0 <= j < arr2.length</code>,然后进行赋值运算 <code>arr1[i] = arr2[j]</code>。</p>\n\n<p>如果无法让 <code>arr1</code> 严格递增,请返回 <code>-1</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>arr1 = [1,5,3,6,7], arr2 = [1,3,2,4]\n<strong>输出:</strong>1\n<strong>解释:</strong>用 2 来替换 <code>5,之后</code> <code>arr1 = [1, 2, 3, 6, 7]</code>。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>arr1 = [1,5,3,6,7], arr2 = [4,3,1]\n<strong>输出:</strong>2\n<strong>解释:</strong>用 3 来替换 <code>5,然后</code>用 4 来替换 3<code>,得到</code> <code>arr1 = [1, 3, 4, 6, 7]</code>。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>arr1 = [1,5,3,6,7], arr2 = [1,6,3,3]\n<strong>输出:</strong>-1\n<strong>解释:</strong>无法使 <code>arr1 严格递增</code>。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= arr1.length, arr2.length <= 2000</code></li>\n\t<li><code>0 <= arr1[i], arr2[i] <= 10^9</code></li>\n</ul>\n\n<p> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 78,
|
||||
"likes": 79,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.1K\", \"totalSubmission\": \"4.7K\", \"totalAcceptedRaw\": 2114, \"totalSubmissionRaw\": 4737, \"acRate\": \"44.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.2K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 2169, \"totalSubmissionRaw\": 4841, \"acRate\": \"44.8%\"}",
|
||||
"hints": [
|
||||
"Use dynamic programming.",
|
||||
"The state would be the index in arr1 and the index of the previous element in arr2 after sorting it and removing duplicates."
|
||||
|
Reference in New Issue
Block a user