mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>现在有一个特殊的排名系统,依据参赛团队在投票人心中的次序进行排名,每个投票者都需要按从高到低的顺序对参与排名的所有团队进行排位。</p>\n\n<p>排名规则如下:</p>\n\n<ul>\n\t<li>参赛团队的排名次序依照其所获「排位第一」的票的多少决定。如果存在多个团队并列的情况,将继续考虑其「排位第二」的票的数量。以此类推,直到不再存在并列的情况。</li>\n\t<li>如果在考虑完所有投票情况后仍然出现并列现象,则根据团队字母的字母顺序进行排名。</li>\n</ul>\n\n<p>给你一个字符串数组 <code>votes</code> 代表全体投票者给出的排位情况,请你根据上述排名规则对所有参赛团队进行排名。</p>\n\n<p>请你返回能表示按排名系统 <strong>排序后</strong> 的所有团队排名的字符串。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>votes = ["ABC","ACB","ABC","ACB","ACB"]\n<strong>输出:</strong>"ACB"\n<strong>解释:</strong>A 队获得五票「排位第一」,没有其他队获得「排位第一」,所以 A 队排名第一。\nB 队获得两票「排位第二」,三票「排位第三」。\nC 队获得三票「排位第二」,两票「排位第三」。\n由于 C 队「排位第二」的票数较多,所以 C 队排第二,B 队排第三。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>votes = ["WXYZ","XYZW"]\n<strong>输出:</strong>"XWYZ"\n<strong>解释:</strong>X 队在并列僵局打破后成为排名第一的团队。X 队和 W 队的「排位第一」票数一样,但是 X 队有一票「排位第二」,而 W 没有获得「排位第二」。 \n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>votes = ["ZMNAGUEDSJYLBOPHRQICWFXTVK"]\n<strong>输出:</strong>"ZMNAGUEDSJYLBOPHRQICWFXTVK"\n<strong>解释:</strong>只有一个投票者,所以排名完全按照他的意愿。\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre><strong>输入:</strong>votes = ["BCA","CAB","CBA","ABC","ACB","BAC"]\n<strong>输出:</strong>"ABC"\n<strong>解释:</strong> \nA 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\nB 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\nC 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\n完全并列,所以我们需要按照字母升序排名。\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre><strong>输入:</strong>votes = ["M","M","M","M"]\n<strong>输出:</strong>"M"\n<strong>解释:</strong>只有 M 队参赛,所以它排名第一。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= votes.length <= 1000</code></li>\n\t<li><code>1 <= votes[i].length <= 26</code></li>\n\t<li><code>votes[i].length == votes[j].length</code> for <code>0 <= i, j < votes.length</code></li>\n\t<li><code>votes[i][j]</code> 是英文 <strong>大写</strong> 字母</li>\n\t<li><code>votes[i]</code> 中的所有字母都是唯一的</li>\n\t<li><code>votes[0]</code> 中出现的所有字母 <strong>同样也</strong> 出现在 <code>votes[j]</code> 中,其中 <code>1 <= j < votes.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 69,
|
||||
"likes": 70,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.9K\", \"totalSubmission\": \"14.5K\", \"totalAcceptedRaw\": 7893, \"totalSubmissionRaw\": 14534, \"acRate\": \"54.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.1K\", \"totalSubmission\": \"14.8K\", \"totalAcceptedRaw\": 8050, \"totalSubmissionRaw\": 14777, \"acRate\": \"54.5%\"}",
|
||||
"hints": [
|
||||
"Build array rank where rank[i][j] is the number of votes for team i to be the j-th rank.",
|
||||
"Sort the trams by rank array. if rank array is the same for two or more teams, sort them by the ID in ascending order."
|
||||
|
Reference in New Issue
Block a user