Given an integer n, you start with a list of integers from n sorted in ascending order from left to right.
You repeatedly apply the following elimination operations until only one integer remains:
Starting from the left, remove every second integer beginning with the second element from the left.
Starting from the right, remove every second integer beginning with the second element from the right.
Keep alternating between left to right and right to left passes until a single number is left.
Return the last remaining integer.
Constraints:
n
Given an integer n, you start with a list of integers from n sorted in ascending order from left to right.
You repeatedly apply the following elimination operations until only one integer remains:
Starting from the left, remove every second integer beginning with the second element from the left.
Starting from the right, remove every second integer beginning with the second element from the right.
Keep alternating between left to right and right to left passes until a single number is left.
Return the last remaining integer.
Constraints:
n