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>给定一个正整数数组 <code>nums</code>和一个整数 <font color=\"#c7254e\"><font face=\"Menlo, Monaco, Consolas, Courier New, monospace\"><span style=\"font-size:12.6px\"><span style=\"background-color:#f9f2f4\">\bk</span></span></font></font>&nbsp;,返回 <font color=\"#c7254e\"><font face=\"Menlo, Monaco, Consolas, Courier New, monospace\"><span style=\"font-size:12.6px\"><span style=\"background-color:#f9f2f4\">num</span></span></font></font>&nbsp;中 「<strong>好子数组」</strong><em>&nbsp;</em>的数目。</p>\n\n<p>如果 <code>nums</code>&nbsp;的某个子数组中不同整数的个数恰好为 <code>k</code>,则称 <code>nums</code>&nbsp;的这个连续、不一定不同的子数组为 <strong>「</strong><strong>好子数组 」</strong>。</p>\n\n<ul>\n\t<li>例如,<code>[1,2,3,1,2]</code> 中有&nbsp;<code>3</code>&nbsp;个不同的整数:<code>1</code><code>2</code>,以及&nbsp;<code>3</code>。</li>\n</ul>\n\n<p><strong>子数组</strong> 是数组的 <strong>连续</strong> 部分。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,1,2,3], k = 2\n<strong>输出:</strong>7\n<strong>解释:</strong>恰好由 2 个不同整数组成的子数组:[1,2], [2,1], [1,2], [2,3], [1,2,1], [2,1,2], [1,2,1,2].\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,1,3,4], k = 3\n<strong>输出:</strong>3\n<strong>解释:</strong>恰好由 3 个不同整数组成的子数组:[1,2,1,3], [2,1,3], [1,3,4].\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= nums[i], k &lt;= nums.length</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 373,
"likes": 377,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Longest Substring Without Repeating Characters\", \"titleSlug\": \"longest-substring-without-repeating-characters\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u65e0\\u91cd\\u590d\\u5b57\\u7b26\\u7684\\u6700\\u957f\\u5b50\\u4e32\"}, {\"title\": \"Longest Substring with At Most Two Distinct Characters\", \"titleSlug\": \"longest-substring-with-at-most-two-distinct-characters\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u81f3\\u591a\\u5305\\u542b\\u4e24\\u4e2a\\u4e0d\\u540c\\u5b57\\u7b26\\u7684\\u6700\\u957f\\u5b50\\u4e32\"}, {\"title\": \"Longest Substring with At Most K Distinct Characters\", \"titleSlug\": \"longest-substring-with-at-most-k-distinct-characters\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u81f3\\u591a\\u5305\\u542b K \\u4e2a\\u4e0d\\u540c\\u5b57\\u7b26\\u7684\\u6700\\u957f\\u5b50\\u4e32\"}]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"25.9K\", \"totalSubmission\": \"56.3K\", \"totalAcceptedRaw\": 25943, \"totalSubmissionRaw\": 56304, \"acRate\": \"46.1%\"}",
"stats": "{\"totalAccepted\": \"26.3K\", \"totalSubmission\": \"57K\", \"totalAcceptedRaw\": 26293, \"totalSubmissionRaw\": 56962, \"acRate\": \"46.2%\"}",
"hints": [],
"solution": {
"id": "140",