1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-25 14:58:56 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>nums</code>&nbsp;,同时给你一个整数&nbsp;<code>key</code>&nbsp;,它在&nbsp;<code>nums</code>&nbsp;出现过。</p>\n\n<p><strong>统计&nbsp;</strong>在 <code>nums</code>&nbsp;数组中紧跟着 <code>key</code>&nbsp;后面出现的不同整数&nbsp;<code>target</code>&nbsp;的出现次数。换言之,<code>target</code>&nbsp;的出现次数为满足以下条件的 <code>i</code>&nbsp;的数目:</p>\n\n<ul>\n\t<li><code>0 &lt;= i &lt;= n - 2</code></li>\n\t<li><code>nums[i] == key</code>&nbsp;且</li>\n\t<li><code>nums[i + 1] == target</code>&nbsp;。</li>\n</ul>\n\n<p>请你返回出现 <strong>最多</strong>&nbsp;次数的<em>&nbsp;</em><code>target</code>&nbsp;。测试数据保证出现次数最多的 <code>target</code>&nbsp;是唯一的。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>nums = [1,100,200,1,100], key = 1\n<b>输出:</b>100\n<b>解释:</b>对于 target = 100 ,在下标 1 和 4 处出现过 2 次,且都紧跟着 key 。\n没有其他整数在 key 后面紧跟着出现,所以我们返回 100 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>nums = [2,2,2,2,3], key = 2\n<b>输出:</b>2\n<b>解释:</b>对于 target = 2 ,在下标 1 2 和 3 处出现过 3 次,且都紧跟着 key 。\n对于 target = 3 ,在下标 4 出出现过 1 次,且紧跟着 key 。\ntarget = 2 是紧跟着 key 之后出现次数最多的数字,所以我们返回 2 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= nums.length &lt;= 1000</code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 1000</code></li>\n\t<li>测试数据保证答案是唯一的。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 4,
"likes": 5,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.8K\", \"totalSubmission\": \"9.8K\", \"totalAcceptedRaw\": 5753, \"totalSubmissionRaw\": 9826, \"acRate\": \"58.5%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 6159, \"totalSubmissionRaw\": 10536, \"acRate\": \"58.5%\"}",
"hints": [
"Count the number of times each target value follows the key in the array.",
"Choose the target with the maximum count and return it."