Cody

Problem 42754. Odd elimination

Inspired by Project Euler problem #539

You'll be given a vector from 1 to n;

Going from left to right, remove the first number and every other number afterward until the end of the list.

Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.

Example with n=9

1 2 3 4 5 6 7 8 9

2 4 6 8

2 6

6

Solution Stats

57.58% Correct | 42.42% Incorrect
Last Solution submitted on Oct 24, 2019

Problem Comments

Problem Recent Solvers33

Suggested Problems

More from this Author13

Problem Tags