values and a number start. While the current number appears in values, double it. As soon as the next number is missing from the array, stop.
Return the number the process stopped at.values=[7, 14, 2, 28, 9], start=7 → 56
7 is there → 14, 14 is there → 28, 28 is there → 56, and 56 is not. The answer is 56.
values=[4, 8, 16], start=2 → 2
2 is not in the array, so nothing is doubled and the answer is 2.
values=[7, 14, 2, 28, 9], start=7
56
Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.