2154. Keep Multiplying Found Values by Two
You are given an array of integers
nums. You are also given an integeroriginalwhich is the first number that needs to be searched for innums.You then do the following steps:
- If
originalis found innums, multiply it by two (i.e., setoriginal = 2 * original).- Otherwise, stop the process.
- Repeat this process with the new number as long as you keep finding the number.
Return the final value of
original.
1 | class Solution { |