Skip to content

Commit 655b269

Browse files
committed
Create README - LeetHub
1 parent 8c57f31 commit 655b269

File tree

1 file changed

+40
-0
lines changed
  • 2154-keep-multiplying-found-values-by-two

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<h2><a href="https://leetcode.com/problems/keep-multiplying-found-values-by-two/">2154. Keep Multiplying Found Values by Two</a></h2><h3>Easy</h3><hr><div><p>You are given an array of integers <code>nums</code>. You are also given an integer <code>original</code> which is the first number that needs to be searched for in <code>nums</code>.</p>
2+
3+
<p>You then do the following steps:</p>
4+
5+
<ol>
6+
<li>If <code>original</code> is found in <code>nums</code>, <strong>multiply</strong> it by two (i.e., set <code>original = 2 * original</code>).</li>
7+
<li>Otherwise, <strong>stop</strong> the process.</li>
8+
<li><strong>Repeat</strong> this process with the new number as long as you keep finding the number.</li>
9+
</ol>
10+
11+
<p>Return <em>the <strong>final</strong> value of </em><code>original</code>.</p>
12+
13+
<p>&nbsp;</p>
14+
<p><strong class="example">Example 1:</strong></p>
15+
16+
<pre><strong>Input:</strong> nums = [5,3,6,1,12], original = 3
17+
<strong>Output:</strong> 24
18+
<strong>Explanation:</strong>
19+
- 3 is found in nums. 3 is multiplied by 2 to obtain 6.
20+
- 6 is found in nums. 6 is multiplied by 2 to obtain 12.
21+
- 12 is found in nums. 12 is multiplied by 2 to obtain 24.
22+
- 24 is not found in nums. Thus, 24 is returned.
23+
</pre>
24+
25+
<p><strong class="example">Example 2:</strong></p>
26+
27+
<pre><strong>Input:</strong> nums = [2,7,9], original = 4
28+
<strong>Output:</strong> 4
29+
<strong>Explanation:</strong>
30+
- 4 is not found in nums. Thus, 4 is returned.
31+
</pre>
32+
33+
<p>&nbsp;</p>
34+
<p><strong>Constraints:</strong></p>
35+
36+
<ul>
37+
<li><code>1 &lt;= nums.length &lt;= 1000</code></li>
38+
<li><code>1 &lt;= nums[i], original &lt;= 1000</code></li>
39+
</ul>
40+
</div>

0 commit comments

Comments
 (0)