Skip to content

Commit 8b012dd

Browse files
committed
Time: 3 ms (62.62%), Space: 42.3 MB (51.10%) - LeetHub
1 parent dbd55c9 commit 8b012dd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public int findFinalValue(int[] nums, int original) {
3+
HashSet<Integer> has= new HashSet<>(nums.length);
4+
for (int i=0;i<=nums.length-1;i++)
5+
has.add(nums[i]);
6+
for (int i=0;i<=nums.length-1;i++) {
7+
if (!has.contains(original))
8+
break;
9+
original = original * 2;
10+
}
11+
return original;
12+
}
13+
}

0 commit comments

Comments
 (0)