You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2><ahref="https://leetcode.com/problems/2-keys-keyboard">650. 2 Keys Keyboard</a></h2><h3>Medium</h3><hr><p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform one of two operations on this notepad for each step:</p>
2
+
3
+
<ul>
4
+
<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>
5
+
<li>Paste: You can paste the characters which are copied last time.</li>
6
+
</ul>
7
+
8
+
<p>Given an integer <code>n</code>, return <em>the minimum number of operations to get the character</em> <code>'A'</code> <em>exactly</em> <code>n</code> <em>times on the screen</em>.</p>
9
+
10
+
<p> </p>
11
+
<p><strongclass="example">Example 1:</strong></p>
12
+
13
+
<pre>
14
+
<strong>Input:</strong> n = 3
15
+
<strong>Output:</strong> 3
16
+
<strong>Explanation:</strong> Initially, we have one character 'A'.
17
+
In step 1, we use Copy All operation.
18
+
In step 2, we use Paste operation to get 'AA'.
19
+
In step 3, we use Paste operation to get 'AAA'.
0 commit comments