Help in Problem

Правка en1, от 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.

Теги #math

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Riyuzak251097 2020-08-01 00:34:53 510 Initial revision (published)