1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +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

@@ -6,13 +6,13 @@
"boundTopicId": null,
"title": "2 Keys Keyboard",
"titleSlug": "2-keys-keyboard",
"content": "<p>There is only one character <code>&#39;A&#39;</code> on the screen of a notepad. You can perform two operations on this notepad for each step:</p>\n\n<ul>\n\t<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>\n\t<li>Paste: You can paste the characters which are copied last time.</li>\n</ul>\n\n<p>Given an integer <code>n</code>, return <em>the minimum number of operations to get the character</em> <code>&#39;A&#39;</code> <em>exactly</em> <code>n</code> <em>times on the screen</em>.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 3\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> Intitally, we have one character &#39;A&#39;.\nIn step 1, we use Copy All operation.\nIn step 2, we use Paste operation to get &#39;AA&#39;.\nIn step 3, we use Paste operation to get &#39;AAA&#39;.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 1\n<strong>Output:</strong> 0\n</pre>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 1000</code></li>\n</ul>\n",
"content": "<p>There is only one character <code>&#39;A&#39;</code> on the screen of a notepad. You can perform one of two operations on this notepad for each step:</p>\n\n<ul>\n\t<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>\n\t<li>Paste: You can paste the characters which are copied last time.</li>\n</ul>\n\n<p>Given an integer <code>n</code>, return <em>the minimum number of operations to get the character</em> <code>&#39;A&#39;</code> <em>exactly</em> <code>n</code> <em>times on the screen</em>.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 3\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> Initially, we have one character &#39;A&#39;.\nIn step 1, we use Copy All operation.\nIn step 2, we use Paste operation to get &#39;AA&#39;.\nIn step 3, we use Paste operation to get &#39;AAA&#39;.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 1\n<strong>Output:</strong> 0\n</pre>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 1000</code></li>\n</ul>\n",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 2514,
"dislikes": 157,
"likes": 2560,
"dislikes": 158,
"isLiked": null,
"similarQuestions": "[{\"title\": \"4 Keys Keyboard\", \"titleSlug\": \"4-keys-keyboard\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Broken Calculator\", \"titleSlug\": \"broken-calculator\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
"exampleTestcases": "3\n1",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"97.5K\", \"totalSubmission\": \"186.7K\", \"totalAcceptedRaw\": 97543, \"totalSubmissionRaw\": 186710, \"acRate\": \"52.2%\"}",
"stats": "{\"totalAccepted\": \"98.8K\", \"totalSubmission\": \"188.8K\", \"totalAcceptedRaw\": 98801, \"totalSubmissionRaw\": 188775, \"acRate\": \"52.3%\"}",
"hints": [
"How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24?"
],