1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 23:11:41 +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>现在有一个特殊的排名系统,依据参赛团队在投票人心中的次序进行排名,每个投票者都需要按从高到低的顺序对参与排名的所有团队进行排位。</p>\n\n<p>排名规则如下:</p>\n\n<ul>\n\t<li>参赛团队的排名次序依照其所获「排位第一」的票的多少决定。如果存在多个团队并列的情况,将继续考虑其「排位第二」的票的数量。以此类推,直到不再存在并列的情况。</li>\n\t<li>如果在考虑完所有投票情况后仍然出现并列现象,则根据团队字母的字母顺序进行排名。</li>\n</ul>\n\n<p>给你一个字符串数组&nbsp;<code>votes</code> 代表全体投票者给出的排位情况,请你根据上述排名规则对所有参赛团队进行排名。</p>\n\n<p>请你返回能表示按排名系统 <strong>排序后</strong> 的所有团队排名的字符串。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>votes = [&quot;ABC&quot;,&quot;ACB&quot;,&quot;ABC&quot;,&quot;ACB&quot;,&quot;ACB&quot;]\n<strong>输出:</strong>&quot;ACB&quot;\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 = [&quot;WXYZ&quot;,&quot;XYZW&quot;]\n<strong>输出:</strong>&quot;XWYZ&quot;\n<strong>解释:</strong>X 队在并列僵局打破后成为排名第一的团队。X 队和 W 队的「排位第一」票数一样,但是 X 队有一票「排位第二」,而 W 没有获得「排位第二」。 \n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>votes = [&quot;ZMNAGUEDSJYLBOPHRQICWFXTVK&quot;]\n<strong>输出:</strong>&quot;ZMNAGUEDSJYLBOPHRQICWFXTVK&quot;\n<strong>解释:</strong>只有一个投票者,所以排名完全按照他的意愿。\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre><strong>输入:</strong>votes = [&quot;BCA&quot;,&quot;CAB&quot;,&quot;CBA&quot;,&quot;ABC&quot;,&quot;ACB&quot;,&quot;BAC&quot;]\n<strong>输出:</strong>&quot;ABC&quot;\n<strong>解释:</strong> \nA 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\nB 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\nC 队获得两票「排位第一」,两票「排位第二」,两票「排位第三」。\n完全并列所以我们需要按照字母升序排名。\n</pre>\n\n<p><strong>示例 5</strong></p>\n\n<pre><strong>输入:</strong>votes = [&quot;M&quot;,&quot;M&quot;,&quot;M&quot;,&quot;M&quot;]\n<strong>输出:</strong>&quot;M&quot;\n<strong>解释:</strong>只有 M 队参赛,所以它排名第一。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= votes.length &lt;= 1000</code></li>\n\t<li><code>1 &lt;= votes[i].length &lt;= 26</code></li>\n\t<li><code>votes[i].length ==&nbsp;votes[j].length</code> for&nbsp;<code>0 &lt;= i, j &lt; votes.length</code></li>\n\t<li><code>votes[i][j]</code>&nbsp;是英文 <strong>大写</strong> 字母</li>\n\t<li><code>votes[i]</code>&nbsp;中的所有字母都是唯一的</li>\n\t<li><code>votes[0]</code>&nbsp;中出现的所有字母 <strong>同样也</strong> 出现在&nbsp;<code>votes[j]</code>&nbsp;中,其中&nbsp;<code>1 &lt;= j &lt; 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."