mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p><code>n</code> 对情侣坐在连续排列的 <code>2n</code> 个座位上,想要牵到对方的手。</p>\n\n<p>人和座位由一个整数数组 <code>row</code> 表示,其中 <code>row[i]</code> 是坐在第 <code>i </code>个座位上的人的 <strong>ID</strong>。情侣们按顺序编号,第一对是 <code>(0, 1)</code>,第二对是 <code>(2, 3)</code>,以此类推,最后一对是 <code>(2n-2, 2n-1)</code>。</p>\n\n<p>返回 <em>最少交换座位的次数,以便每对情侣可以并肩坐在一起</em>。 <i>每次</i>交换可选择任意两人,让他们站起来交换座位。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> row = [0,2,1,3]\n<strong>输出:</strong> 1\n<strong>解释:</strong> 只需要交换row[1]和row[2]的位置即可。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> row = [3,2,0,1]\n<strong>输出:</strong> 0\n<strong>解释:</strong> 无需交换座位,所有的情侣都已经可以手牵手了。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2n == row.length</code></li>\n\t<li><code>2 <= n <= 30</code></li>\n\t<li><code>n</code> 是偶数</li>\n\t<li><code>0 <= row[i] < 2n</code></li>\n\t<li><code>row</code> 中所有元素均<strong>无重复</strong></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 330,
|
||||
"likes": 336,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"First Missing Positive\", \"titleSlug\": \"first-missing-positive\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u7f3a\\u5931\\u7684\\u7b2c\\u4e00\\u4e2a\\u6b63\\u6570\"}, {\"title\": \"Missing Number\", \"titleSlug\": \"missing-number\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u4e22\\u5931\\u7684\\u6570\\u5b57\"}, {\"title\": \"K-Similar Strings\", \"titleSlug\": \"k-similar-strings\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u76f8\\u4f3c\\u5ea6\\u4e3a K \\u7684\\u5b57\\u7b26\\u4e32\"}]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"31.5K\", \"totalSubmission\": \"47.4K\", \"totalAcceptedRaw\": 31482, \"totalSubmissionRaw\": 47438, \"acRate\": \"66.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"31.9K\", \"totalSubmission\": \"48.1K\", \"totalAcceptedRaw\": 31923, \"totalSubmissionRaw\": 48109, \"acRate\": \"66.4%\"}",
|
||||
"hints": [
|
||||
"Say there are N two-seat couches. For each couple, draw an edge from the couch of one partner to the couch of the other partner."
|
||||
],
|
||||
|
Reference in New Issue
Block a user