Help in Problem

Revision en1, by Riyuzak251097, 2020-08-01 00:34:53

I recently came across an interesting problem You are given n cards numbered from 1 to N with 1 at the top and N at the bottom. You are supposed to remove elements alternatively from the deck with removing the first card and then push the next card at the bottom of the deck. The process stops when one card is left. Find the Number of the last card left. Can someone help me in getting the intuition in solving the problem above. I was required to solve it in less than O(n) time complexity.

Tags #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Riyuzak251097 2020-08-01 00:34:53 510 Initial revision (published)