Leetcode 390. Elimination Game
Determine the last remaining number after repeatedly removing every other element from the list [1..n], alternating left-to-right and right-to-left passes. Because n can be as large as 1e9, the solution relies on a mathematical/recurrence insight (not direct simulation) to compute the result efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.