What is the appropriate way to solve this question, I solve this question using circular linked list(Deleting all the alternate elements untless one element left). and element which is left is the answer. But this approach is taking too long time.

I referred this solution but I didn’t get what approach the guy used.

Thanks in advance.

The problem is classical Josephus Problem

For more information about this problem you can visit Wikipedia

The mathematical analysis of this problem is brialliantly explained at exploringbinary

1 Like

Thank you very much man it helped a lot. Can you recommend me some source from where I can get this sort of stuff.