1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 13:06:47 +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>\nclass FooBar {\n public void foo() {\n&nbsp; &nbsp; for (int i = 0; i &lt; n; i++) {\n&nbsp; &nbsp; &nbsp; print(\"foo\");\n&nbsp; }\n }\n\n public void bar() {\n&nbsp; &nbsp; for (int i = 0; i &lt; n; i++) {\n&nbsp; &nbsp; &nbsp; print(\"bar\");\n&nbsp; &nbsp; }\n }\n}\n</pre>\n\n<p>两个不同的线程将会共用一个 <code>FooBar</code>&nbsp;实例:</p>\n\n<ul>\n\t<li>线程 A 将会调用&nbsp;<code>foo()</code>&nbsp;方法,而</li>\n\t<li>线程 B 将会调用&nbsp;<code>bar()</code>&nbsp;方法</li>\n</ul>\n\n<p>请设计修改程序,以确保 <code>\"foobar\"</code> 被输出 <code>n</code> 次。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1\n<strong>输出:</strong>\"foobar\"\n<strong>解释:</strong>这里有两个线程被异步启动。其中一个调用 foo() 方法, 另一个调用 bar() 方法,\"foobar\" 将被输出一次。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 2\n<strong>输出:</strong>\"foobarfoobar\"\n<strong>解释:</strong>\"foobar\" 将被输出两次。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 1000</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 151,
"likes": 157,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Print in Order\", \"titleSlug\": \"print-in-order\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u6309\\u5e8f\\u6253\\u5370\"}, {\"title\": \"Print Zero Even Odd\", \"titleSlug\": \"print-zero-even-odd\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6253\\u5370\\u96f6\\u4e0e\\u5947\\u5076\\u6570\"}]",
@@ -65,7 +65,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"49.8K\", \"totalSubmission\": \"88.6K\", \"totalAcceptedRaw\": 49813, \"totalSubmissionRaw\": 88645, \"acRate\": \"56.2%\"}",
"stats": "{\"totalAccepted\": \"51.2K\", \"totalSubmission\": \"91K\", \"totalAcceptedRaw\": 51203, \"totalSubmissionRaw\": 91029, \"acRate\": \"56.2%\"}",
"hints": [],
"solution": null,
"status": null,