Skip to content

Commit 6bffe22

Browse files
committed
Time: 0 ms (100%), Space: 17.9 MB (56.67%) - LeetHub
1 parent 3b7c408 commit 6bffe22

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from typing import List
2+
3+
4+
class Solution:
5+
def findFinalValue(self, nums: List[int], original: int) -> int:
6+
numSet = set(nums)
7+
target = original
8+
while target <= 1000:
9+
if target not in numSet:
10+
return target
11+
target *= 2
12+
return target
13+
14+
15+
nums = [5, 3, 6, 1, 12]
16+
original = 3
17+
print(Solution().findFinalValue(nums, original))
18+
nums = [2, 7, 9]
19+
original = 4
20+
print(Solution().findFinalValue(nums, original))

0 commit comments

Comments
 (0)