1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +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<pre>\npublic class Foo {\n&nbsp; public void first() { print(\"first\"); }\n&nbsp; public void second() { print(\"second\"); }\n&nbsp; public void third() { print(\"third\"); }\n}</pre>\n\n<p>三个不同的线程 A、B、C 将会共用一个&nbsp;<code>Foo</code>&nbsp;实例。</p>\n\n<ul>\n\t<li>线程 A 将会调用 <code>first()</code> 方法</li>\n\t<li>线程 B 将会调用&nbsp;<code>second()</code> 方法</li>\n\t<li>线程 C 将会调用 <code>third()</code> 方法</li>\n</ul>\n\n<p>请设计修改程序,以确保 <code>second()</code> 方法在 <code>first()</code> 方法之后被执行,<code>third()</code> 方法在 <code>second()</code> 方法之后被执行。</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>尽管输入中的数字似乎暗示了顺序,但是我们并不保证线程在操作系统中的调度顺序。</li>\n\t<li>你看到的输入格式主要是为了确保测试的全面性。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3]\n<strong>输出:</strong>\"firstsecondthird\"\n<strong>解释:</strong>\n有三个线程会被异步启动。输入 [1,2,3] 表示线程 A 将会调用 first() 方法,线程 B 将会调用 second() 方法,线程 C 将会调用 third() 方法。正确的输出是 \"firstsecondthird\"。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,3,2]\n<strong>输出:</strong>\"firstsecondthird\"\n<strong>解释:</strong>\n输入 [1,3,2] 表示线程 A 将会调用 first() 方法,线程 B 将会调用 third() 方法,线程 C 将会调用 second() 方法。正确的输出是 \"firstsecondthird\"。</pre>\n\n<p>&nbsp;</p>\n\n<ul>\n</ul>\n<strong>提示:</strong>\n\n<ul>\n\t<li><code>nums</code> 是 <code>[1, 2, 3]</code> 的一组排列</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 375,
"likes": 386,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Print FooBar Alternately\", \"titleSlug\": \"print-foobar-alternately\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u4ea4\\u66ff\\u6253\\u5370 FooBar\"}]",
@@ -65,7 +65,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"88.1K\", \"totalSubmission\": \"135K\", \"totalAcceptedRaw\": 88138, \"totalSubmissionRaw\": 135002, \"acRate\": \"65.3%\"}",
"stats": "{\"totalAccepted\": \"90.4K\", \"totalSubmission\": \"138.6K\", \"totalAcceptedRaw\": 90409, \"totalSubmissionRaw\": 138574, \"acRate\": \"65.2%\"}",
"hints": [],
"solution": null,
"status": null,