LeetCode #2154: Keep Multiplying Found Values by Two
β’ 35 words β’ 1 min
LeetCode #2154: Keep Multiplying Found Values by Two:
python
class Solution:
def findFinalValue(self, nums: List[int], original: int) -> int:
s = set(nums)
while True:
if original in s:
original <<= 1
else:
break
return original